vasiliy-vdovichenko / ncrontab

Automatically exported from code.google.com/p/ncrontab

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Discrepancy between weekday expression "Sun-Sat" and "Mon-Sun"

GoogleCodeExporter opened this issue · comments

What steps will reproduce the problem?
Use NCrontab to get the next occurrence after 2012-01-27T12:23:37 for the 
following two expressions:
- "30 1 * * Sun-Sat | UTC"
- "30 1 * * Mon-Sun | UTC"

What is the expected output? What do you see instead?
Both expressions say "1:30 A.M. every weekday", so the expected output is 
2012-01-28T01:30:00. But the second expression yields something else (29th 
instead of 28th). I assume that NCrontab treats "Mon-Sun" (numerical: 1-0) as 
"Sun-Mon" (numerical: 0-1) which is not really what I would expect!?

What version of the product are you using? On what operating system?
NCrontab 1.0

Original issue reported on code.google.com by andreas.sommer87 on 3 Feb 2012 at 12:28

I propose the following patch. What do you think?

Original comment by andreas.sommer87 on 5 Feb 2012 at 10:49

Attachments:

The weekday names are convenient aliases for the numerical values with Sunday 
being 0. While I agree that Mon-Sun may read like all days from Monday to 
Sunday, what it really means is 1-0. This is no different than writing 3-2 for 
the hour field where it does not mean from 3 AM till 2 AM of next day. Reverse 
ranges are inverted so Mon-Sun or 1-0 becomes 0-1. This is by design.

Original comment by azizatif on 5 Apr 2012 at 4:00

  • Changed state: WontFix