Export to GitHub

ncrontab - issue #6

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


Posted on Feb 3, 2012 by Happy Hippo

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

Comment #1

Posted on Feb 5, 2012 by Happy Hippo

I propose the following patch. What do you think?

Attachments

Comment #2

Posted on Apr 5, 2012 by Massive Ox

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.

Status: WontFix

Labels:
Type-Defect Priority-Medium