Closed achifal closed 1 year ago
Yes, parsing a partial date will fill in the gaps with the current year and month. However, the reason you're getting invalid dates sometimes is because the token d
represents a day of the week, not a day of the month (which is D
). I'm not sure if this was the intention.
So 05-1
is being parsed as a Monday (day-of-week 1
) in the 5th month. Without a day of the month present, the parser defaults to the 1st. May 1st, 2023 happens to be a Monday, which is why that example works out. But the documentation mentions:
The parser also confirms that the day-of-week (when included) is consistent with the date.
Since May 1st, 2022 and May 1st, 2024 are not Mondays, the parser fails the validation.
Moment-timezone version which you use:
Version: 0.5.39
Issue description: