The Senate passed legislation Wednesday to provide more flexibility to small businesses that have received forgivable loans under the Paycheck Protection Program, giving them more time to use the money just ahead of a deadline to forgive the first round of payments.

The legislation passed by unanimous consent and now goes to President Trump’s desk, following House passage of the bill last week. The White House has not said whether Trump will sign the bill, but the president has indicated support for its goals.

The central aim of the legislation is to allow businesses 24 weeks — instead of eight — to spend money they receive under the Paycheck Protection Program and have the loans forgiven. The restaurant industry and other business groups had pushed for the change, saying that eight weeks was not enough time, given that the coronavirus pandemic has forced businesses to stay shut longer than anticipated when the Paycheck Protection Program was created in late March as part of the $2 trillion Cares Act.

Lawmakers of both parties supported the change.

“Currently, workers may be brought back for the eight weeks, but what good is it if they’re then laid off at the end of that short period? It’s unrealistic,” Senate Minority Leader Charles E. Schumer (D-N.Y.) said Wednesday on the Senate floor. “And small businesses need assistance that can cover the full length of this crisis.”

The Paycheck Protection Program was overwhelmed by demand as soon as it was created, with the initial $350 billion in funding exhausted within weeks, despite a glitchy rollout and controversy over large companies that got the money intended for small businesses. In April, Congress approved an additional $310 billion so that more companies could receive funding.

“The Senate has always committed to standing behind this popular program,” said Majority Leader Mitch McConnell (R-Ky.). “Back in April, when it ran low on funds, we worked together to add more resources. And today, we are passing another piece of legislation that makes a few targeted changes to the program.”

But demand for the program has slowed and there is more than $100 billion left, which some business groups attribute to concerns about strings attached to the program. Businesses that got loans in the initial weeks after its creation are now running up against the eight-week deadline to spend the money, even though some haven’t been able to reopen yet.

Also, a majority of the money has to be spent on payroll in order for the loans to be forgiven. The Treasury Department initially established that 75 percent of the loan had to be spent on payroll for the money to be fully forgiven, but the House bill changed that figure to 60 percent.

Some key senators including Marco Rubio (R-Fla.) and Susan Collins (R-Maine) had concerns about the way the House bill was crafted, arguing it might not allow businesses to have loans partially forgiven if they spend just short of 60 percent of the money on payroll. They said they would work to pursue technical fixes to the legislation going forward. But with the House out of session, senators viewed it as urgent to pass the legislation into law in time for businesses that are running up against the eight-week deadline to benefit from it.

The legislation approved Wednesday also allows payroll tax deferral for recipients and extends a two-year repayment deadline for the balance of loans that are not forgiven.

There was dispute about a provision of the House bill that extends a June 30 rehiring deadline. Sen. Ron Johnson (R-Wis.), who has criticized the program for sending money to some businesses that don’t really need it, initially blocked an attempt by Schumer to pass the new bill. Johnson was seeking assurances that the extension of the June 30 deadline wouldn’t mean that businesses could continue to apply for new loans past that time, just that they would have more time to rehire employees. Ultimately Johnson withdrew his objection after working with key lawmakers on a letter to be entered into the congressional record to memorialize his interpretation of the provision.

The Paycheck Protection Program offers loans up to $10 million to businesses with 500 or fewer employees. Through May it had issued more than 4 million loans totaling more than $510 billion.