1,312. Partial Mourning
203:2 There is a practice to observe partial mourning by oneself for other relatives, the first week until after Shabbos. In such a case, one does not bathe in hot water or change his clothes as he usually does before Shabbos. Not all relatives are the same in this matter. If the deceased was a first cousin or a grandchild, he can put on fresh clothes for Shabbos except for the outermost layer. For a father-in-law, a mother-in-law, or a grandparent, one only puts on fresh undergarments. The practice is also not to eat outside one's home - not at a meal celebrating a mitzvah and not at a social event. After Shabbos, everything is permitted.
203:3 If it's not known whether or not a baby was born full-term and he dies within thirty days, or on the thirtieth day, then even if he had grown hair and nails, one does not tear his garments or observe aveilus (mourning) for him because he may have been premature and not viable. If he died after thirty days, even on the thirty-first day at a time of day earlier than his birth (i.e., not 31 complete days but merely 30 days and change), then one does tear his garments and he observes both aninus and aveilus (forms of mourning), unless it was known for a fact that this baby was born after only eight months, in which case he is not considered to have been viable. If one knows for sure that a baby was born after nine months, such as if the husband and wife separated so we know this baby was born after the full nine months, then even if he died on the day he was born, one tears his garments and observes both aninus and aveilus.