cron icon indicating copy to clipboard operation
cron copied to clipboard

Document Weekday Ordinals

Open manorom opened this issue 3 years ago • 3 comments

Hi,

First of all, thanks for this great crate.

However, the numbering of weekdays seems unusual to me. On the machines I usually work, the crontab uses a 0 for Sunday, 1 for Monday and so on. This crate seems to use 1 for Sunday and not accept 0.

Maybe this should be documented somewhere.

manorom avatar Jul 14 '21 20:07 manorom

I would argue that it should be changed to be 0-6 or have a configuration to pick between 0-6 or 1-7 as right now if we wanted to use this crate we'd need to fork it and change it to 0-6. Otherwise, the crate looks great!

sbditto85 avatar Aug 25 '21 20:08 sbditto85

See also: #37. Sunday=1 was taken from the Quartz service.

Maybe this should be documented somewhere.

+1.

I would argue that it should be changed to be 0-6

I can't do this as there are folks using it for parsing Quartz's flavor of cron expressions.

or have a configuration to pick between 0-6 or 1-7

This would be great! There are other settings that would be nice to have, too. Off the top of my head:

  • Named ordinal support for other languages (Mon,Tues,Wed in English -> Lun,Mar,Mer in French)
  • Some locales start the week on Monday, not Sunday.
  • 5-field expressions in which the leftmost field is meant to be a year instead of the rightmost being seconds.

I'd like to have a builder API that lets folks opt into these settings. Exposing a day-of-week ordinals option would be a good place to start. If anyone is interested in implementing that, let me know and we can sketch out what the API should look like.

zslayton avatar Sep 07 '21 12:09 zslayton

Hello, I'd also like to say this is a great crate! :-) I'm also here because of the weekday numbering scheme; I was expecting a standard unix scheme where 0 and 7 means sunday, while 1 means monday, etc. It would be great if this behavior could be enabled by some option.

hce avatar Oct 11 '21 13:10 hce