The Gift of the Magi is set in the same time period it was written which is the early 1900s. The link below will take you to a summary of O. Henry's career and the story. The summary mentions the fact that the short stories has been included in many anthologies throughout the years, but I remember when it was adapted to Sesame Street. Bert and Ernie were part of a Christmas special on TV in the 1970s or 1980s where the same story unfolds except for the gifts that are sacrificed and exchanged. Bert sells his paper clip collection to buy Ernie a soap dish for his Rubber Duckie and Ernies sells his Rubber Ducky for a box to hold Bert's paper clips.
I think the wife in O. Henry's original sacrifices the most since she cut and sold her hair. To a woman that would be so embarrassing especially in the early 1900s when women were supposed to look and act feminine or they were socially rejected.
Follow the link for more information on the story. :)