Under Mosaic law (Leviticus 12.3), the couple were obliged to circumcise the child on the eighth day after birth. Thirty-three days after circumcision, or the fortieth day after birth, in accordance with the law prescribed in Leviticus 12.1-8, the couple presented their eldest son at the Temple and offered a sacrifice for Mary's purification.
Because their modest financial circumstances did not allow them to offer a lamb, they offered the sacrifice permitted for the poorest: two turtledoves or two young pigeons.
This modest offering indicates that the event took place before the Magi's visit, when they brought highly valuable gifts. The family thus stayed in Bethlehem for at least a month and a half. Faced with these additional expenses, Joseph may plausibly have had to find work locally, perhaps using his own tools, to support his family. The Magi's gifts undoubtedly eased their financial situation afterwards.