Skip to content
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

v5 regression: next() doesn't set milli-seconds correctly #363

Open
maplesteve opened this issue Feb 16, 2025 · 1 comment
Open

v5 regression: next() doesn't set milli-seconds correctly #363

maplesteve opened this issue Feb 16, 2025 · 1 comment
Labels

Comments

@maplesteve
Copy link

v5 doesn't set the milli-seconds to zero for the next date. They are carried over from currentDate instead.

const cronExpression = CronExpressionParser.parse('* * * * *', {
   currentDate: '2020-03-06T10:02:01.002Z',
   tz: 'Europe/Berlin'
 })
 const res = cronExpression.next().toISOString()

res is "2020-03-06T10:03:00.002Z" in v5, but should be "2020-03-06T10:03:00.000Z". With v4 the milli-seconds were correct.

@harrisiirak
Copy link
Owner

Hi @maplesteve,

Thanks for reporting this!

This is definitely a regression. It was introduced due optimization I made here. Millisecond precision is not required by the schedule loop itself, but definitely should be set to 0 in the final result. Should be an easy fix.

Best regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants