cron icon indicating copy to clipboard operation
cron copied to clipboard

Make 'seconds' field optional

Open zslayton opened this issue 8 years ago • 2 comments

The year field is currently optional, with expressions being comprised of six or seven fields accordingly. I would like to also accept expressions which have neither seconds nor years, for a total of five fields. Importantly, expressions that do not include seconds but which do include years would be illegal.

zslayton avatar Feb 14 '17 03:02 zslayton

@zslayton

May be use proxy object 'ScheduleBuilder'

let s = Schedule::builder() // ScheduleBuilder::default()
    .with_seconds(true)
    .with_years(true)
    .parse(...)

anton-dutov avatar Oct 05 '19 21:10 anton-dutov

Importantly, expressions that do not include seconds but which do include years would be illegal.

To clarify this, the parser would treat any expression with 6 fields as having years. It would be impossible to detect the user's intent in some cases (e.g. * * * * * *), so this would simply be noted in the documentation.

May be use proxy object 'ScheduleBuilder'

I'm open to this approach. There are other settings that it would be nice to support -- e.g. whether day_of_week should be 0-indexed or 1-indexed, which varies between implementations. (This is relevant to #37.)

zslayton avatar Jan 27 '21 13:01 zslayton