New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
If today's date has a date-part that's bigger than the number of days in the target month, you could not set the schedule to that date because of the way the Date object validates dates.
Explanation of bug:
const d = new Date(); // ex: Date is 1/30/2024
d.setFullYear(2025) // Date is now 1/30/2025
d.setMonth(2); // Date tries to be 2/30/2025, which doesn't exist, and rolls over to 3/1/2025
d.setDate(15); // Date is now 3/15/2025 instead of 2/15/2025 as expected
Possible dumb question since I have had very little occasion to use the Date class and so am probably missing something obvious, but it looks like all these places are creating a new Date object and initializing it to the same date/time as an existing date object.
Couldn't they all be replaced by using the form of the Date constructor that takes an existing date object? E.g., targetStartDate = new Date(startDate)?