The four-decade-long bull market in bonds is over, but that doesn’t mean you should dump them.

How much more of a beating can bond investors take?

So far in 2022, with inflation raging, bonds have lost 10%—among the worst returns in U.S. history. On Wednesday, the Federal Reserve raised interest rates by 0.5 percentage point, the sharpest increase in 22 years.

Yet, just as your body begins healing from an injury before you can feel any improvement, the worst for bond investors might already be ending. Those who dump bonds now might be making a mistake by selling low after buying high.

Let’s start by putting the pain in historical perspective. 

The U.S. bond market has had positive returns, before inflation, in all but four years since 1976. Even in 1994, when the Federal Reserve raised interest rates six times for a total of 2.5 percentage points, bonds lost only 3% in the aggregate.

Almost never has the U.S. bond market lost as much money as in the first four months of 2022, according to Edward McQuarrie, an emeritus professor of business at Santa Clara University who studies asset returns over the centuries.

Long-term Treasury bonds lost more than 18% this year through April 30. That surpasses the previous record, a loss of 17% in the 12 months ending in March 1980, says Mr. McQuarrie. The broad bond market has performed worse so far in 2022, he says, than in any complete year since 1792 except one. That was all the way back in 1842, when a deep depression approached rock-bottom.

It’s worth noting that, adjusted for inflation, at least nine past periods have been worse, says Bryan Taylor, chief economist at Global Financial Data, a research firm in San Juan Capistrano, Calif.