tisonkun / cronexpr

Calculate the next timestamp matching a given crontab pattern
https://docs.rs/cronexpr
Apache License 2.0
49 stars 2 forks source link

Roadmap to 1.0 #3

Closed tisonkun closed 1 month ago

tisonkun commented 1 month ago

Determinate and finalize these two things:

https://github.com/tisonkun/cronexpr/blob/21bbfb1749854c931b9f1637168ce68d89e795bd/src/lib.rs#L79-L84

https://github.com/tisonkun/cronexpr/blob/21bbfb1749854c931b9f1637168ce68d89e795bd/src/parser.rs#L204-L206

This might lightly rework the parsing logics and matching logics. While the user interfaces should not be changed and only new inputs are accepted, I'd leave a few time to see if we can do this nontrivial rework before 1.0.

tisonkun commented 1 month ago

For DayOfWeek, it seems:

  1. SUN-SAT maps to 0-6 staticly. So SUN is always 0.
  2. 0-7, 1-7, 2-7 all works. With our implementation, we can merge 0 and 7 at last. (Because we map 0-6 to 1-7 to match jiff's Weekday repr).

NearestWeekday, LastDayOfWeek, NthDayOfWeek can occur on single item, but never in range or step. * can never occur in range (1-* is invalid).

So typically, we'd implement it as:

Then we can see how to parametize these.

tisonkun commented 1 month ago

Closed by https://github.com/tisonkun/cronexpr/commit/4e4e24976c07dbae5c8ea868baccd7b4dfa7c10b and https://github.com/tisonkun/cronexpr/commit/0e7f6fadbada74bc667ff35bf6022026ea2431a5.