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

support L in dayOfMonth field #71

Open
graingert opened this issue Apr 20, 2017 · 1 comment
Open

support L in dayOfMonth field #71

graingert opened this issue Apr 20, 2017 · 1 comment

Comments

@graingert
Copy link

graingert commented Apr 20, 2017

This is to match the Last day in a month,

currently you have to use

Cron("55 23 30 4,6,9,11 ?")
Cron("55 23 31 1,3,5,7,8,10,12 ?")
Cron("55 23 28 2               ?")

but this still doesn't handle leap days properly

I'd like to be able to use:

Cron("55 23 L * ?")
@alonsodomin
Copy link
Owner

This is (unfortunately) not supported yet in 0.4, although I would really like to have it. Problem is that it might take a bit of time to get it working. The implementation itself is not trivial as I just wouldn't like to support L in day of month, the L itself represents additional constraints to the specific expression and, looking a more complete CRON implementations, we have a wide variety of thos type of constraints:

  • L alone in day of month meaning the last day of the month
  • nL in day of week, being n a number between 0 and 6 meaning the last day of week of a month
  • nW in day of month, being n a number between 0 and 31 meaning the nearest weekday (Monday-Friday) to the given month day.
  • n#m in day of week, being n a number between 0 and 6 and m a number between 0 and 5 meaning the mth day of the month.

Of course all of this needs to be implemented individually, the first part would be tackling the first two points (people would find it weird that L is supported in day of month but not supported in _day of week) and should put the ground work needed to implement the rest of the constraints.

Additionally, the documentation is missing mentioning the fact that not the whole cron standard (if there is one) is supported so this should be included ASAP.

As an end note, I believe that, providing that in cron4s there is a seconds field, the correct expression should be:

Cron("0 55 23 L * ?")

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

No branches or pull requests

2 participants