-
Notifications
You must be signed in to change notification settings - Fork 25
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
Wrong DateTime with "1 1 1 31 * ?" #73
Comments
It seems totally bizarre because I can match a time in the future from "2016-09-04T00:00:00.000Z" scala> val newDate = new DateTime("2016-10-31T01:01:01.000Z", DateTimeZone.UTC)
newDate: org.joda.time.DateTime = 2016-10-31T01:01:01.000Z
scala> Cron.unsafeParse("1 1 1 31 * ?").allOf(newDate)
res44: Boolean = true |
This also happens for "1 1 1 30 * ?" with an input date in February. scala> val oldDate = new DateTime("2016-02-04T00:00:00.000Z", DateTimeZone.UTC)
oldDate: org.joda.time.DateTime = 2016-02-04T00:00:00.000Z
scala> Cron.unsafeParse("1 1 1 30 * ?").next(oldDate)
res46: Option[org.joda.time.DateTime] = None It seems that cron is forgetting to roll on the month in this case. |
I see, surely what's happening here is that each field is getting rolled up individually from each other and when the turn comes for the day of month, it fails because the month of the original date is wrong as it hasn't been rolled up yet. The reason why it works when matching is because the match operations do not perform any date field rolling, therefore, if you are able to have a This is not too difficult to solve so I'll try to get something working ASAP. Thanks for reporting! |
@alonsodomin any update on this? |
@graingert Nothing really worth mentioning yet, been quite busy with a series of personal matters and did not have any serious time to dedicate to this. I did prototype a couple of solutions but this has highlighted the fact that there is a design flaw in the date-time integration. I expect to be able to tackle in the next weeks as soon as I get some free time. |
Hi !
In this case, previous is |
A fix has been merged into master, a new release will be published in the next days. |
Thanks, that's super handy!
…On 14 Jul 2017 12:26, "A. Alonso Dominguez" ***@***.***> wrote:
A fix has been merged into master, a new release will be published in the
next days.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#73 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAZQTJjz-wJ7aYHGeIkkWLz7QcX4WG3-ks5sN1BRgaJpZM4NDBb1>
.
|
Should be
Some(2016-10-31T01:01:01.000Z)
The text was updated successfully, but these errors were encountered: