Next run date not correct if CRON indicates a month
Closed this issue · 2 comments
The calculation of the "next run date" is incorrect if the CRON expression has an explicit month.
To replicate using JsReport Studio 1.9.2, create a schedule using the CRON expression "0 12 * 1 *". This correctly translates to "At 12:00 PM, only in January" but the next run date is saved as February 1, 2018, at 12:00 PM. It should be January 4, 2018, at 12:00 PM (based on the time I'm typing this).
It appears that the "cron" NPM library interprets the month as zero-based, which is incorrect. Looks like the "cron-parser" library is a correct implementation.
hi! thanks for the issue report.
as described in scheduling docs the format for months is 0-11
, and as you found this is because the cron
package parse the expressions like that.
we agree that this is confusing since the standard and more used format for months is 1-12
and we are planning to change the month format to match the standard. unfortunately this is a breaking change which could affect users using the current format 0-11
so we can not hot fix in current v1.x.x
releases, but this change will happen in v2
with an upgrade utility to easy the work for users that have schedules in old format. so in the mean time try to use the format 0-11
, we are going to match the standard format in next major release v2
this was fixed in v2