On the day the Knicks added Metta World Peace, they lost J.R. Smith — possibly for all of training camp and the first two weeks of the regular season.

Four days after announcing his new four-year, $24.7 million package, Smith underwent surgery yesterday in New York to repair a patellar tendon and a torn meniscus, both in his left knee, putting him out three to four months.

The Knicks said Smith had two chronic injuries that gradually worsened. According to a league source, the tendon was chipped.

Smith, who will be 28 in September, certainly won’t be ready for Day 1 of training camp in early October and could miss the season opener later that month.

The Knicks knew about the issue when the season ended and knew Smith would need surgery. Earl Smith, J.R.’s father, claimed the surgery was timed for mid-July during summer league and it had no bearing on his son hiding his injury during free agency.

A source said teams that inquired about Smith were made aware of his impending surgery. The Knicks had no major qualms about offering him a four-year deal because they considered it below market value and the maximum they were allowed to offer under Early Bird Rights.

The Post reported exclusively on May 23 that Smith played during the Pacers series with an undisclosed left knee injury, with a source saying it was swollen with fluid buildup. The source said at the time, “He shouldn’t have even been playing.’’

Earl Smith said the timing of the surgery was due to it being most convenient for the Knicks’ medical and training staffs, which were to return to Las Vegas so there would be no lapse in his son’s rehab. If part of the preseason would be sacrificed, so be it.

“That was the plan all along,” the elder Smith said.

However, only one Knicks trainer is in Las Vegas, along with team medical director Dr. Lisa Callahan, so the timing still seems odd.

Earl Smith said he expects his son to be back for the season opener.

“Knowing J.R., he will be,’’ Earl Smith said. “It’s a great possibility.’’

Smith’s knee issue helps explain his downturn in the playoffs as the fluid likely was caused by the wear and tear of his cartilage. The Post reported Smith had played with varying degrees of knee pain since March, but he did not miss a single game because of injury. He played 80 of 82 games, resting the final two with the rest of the starters.