vasiliy-vdovichenko / ncrontab

Automatically exported from code.google.com/p/ncrontab
Apache License 2.0
0 stars 0 forks source link

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

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
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

GoogleCodeExporter commented 8 years ago
I propose the following patch. What do you think?

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

Attachments:

GoogleCodeExporter commented 8 years ago
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