Closed Mtillmann closed 2 years ago
FWIW, the following chrono.parse
-syntax seems to yield the desired values:
let referenceDate = new Date('08-02-2022'),
parsingOptions = {
forwardDate: true
},
schedules = [
['next_morning', chrono.parse('Tomorrow, 10:00', referenceDate, parsingOptions)[0].start.date()],
['next_evening', chrono.parse('Tomorrow, 19:00', referenceDate, parsingOptions)[0].start.date()],
['next_saturday', chrono.parse('Saturday, 10:00', referenceDate, parsingOptions)[0].start.date()],
['next_sunday', chrono.parse('Sunday, 15:00', referenceDate, parsingOptions)[0].start.date()]
];
Hello. Thanks for reporting.
What happened was the reference date "August 2, 2022 - Tuesday" (enum date 2)
Calculating "next" based on the date-enum-offset rather than date-window seems like a bug.
However, deciding e.g. what is "Saturday" vs "Next Saturday" has been a difficult edge case, I need some more time to check if it doesn't break any current tests.
The d0551cd350f00fce11fa7e9fa860e9d93679047d fixes this issue, but there are other changes relating to the day of the week I want to clean up.
It should be released in the new minor version (2.4.0) sometime next week.
@wanasit Thanks a lot for taking the time mate 🙇
Published. Please update to 2.4.1+
yields
next_sunday
works as expected whilenext_saturday
is one week off. Am I missing something?