zslayton / cron

A cron expression parser in Rust
Apache License 2.0
376 stars 69 forks source link

Document Weekday Ordinals #89

Open manorom opened 3 years ago

manorom commented 3 years ago

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.

sbditto85 commented 3 years ago

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!

zslayton commented 3 years ago

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:

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.

hce commented 3 years ago

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.