-
Notifications
You must be signed in to change notification settings - Fork 622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!: UNIX standard alignments #667
feat!: UNIX standard alignments #667
Conversation
update month indexing from 0-11 (Jan-Dec) to 1-12 (Jan-Dec)
46c2ddf
to
f64a47a
Compare
support day-of-week indexing 0-7 (Sun-Sun) this only affects cron string parsing, not the way the library works under the hood
lib/time.js
Outdated
@@ -671,8 +671,10 @@ function CronTime(luxon) { | |||
|
|||
_hasAll: function (type) { | |||
const constraints = CONSTRAINTS[TIME_UNITS.indexOf(type)]; | |||
const low = constraints[0]; | |||
const high = type === 'dayOfWeek' ? constraints[1] - 1 : constraints[1]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It bothers me that 'dayOfWeek' is the only time unit being referenced as a plain string in the code, which was until now perfectly generic. But since we support it as an upper bound for cron string parsing, it still needs its constraints to be different than before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you want you can do something like
const dayOfWeekType = TIME_UNITS[5];
const high = type === dayOfWeekType ? constraints[1] - 1 : constraints[1];
to keep it generic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@intcreator I expanded on that idea and found something that should be better, please let me know what you think: 09e5d7c
Hey @intcreator 👋 So the changes for the The more complicated part was for Please let me know your thoughts on this 😉 |
looking good so far, thanks for your work on this! we'll probably want to put this and potentially other breaking changes on a v3 branch that people can test on/we can release as a preview before the official v3 release |
0cd7f87
to
7dfd34b
Compare
rebased against |
We might want to notify the folks at NestJS of this change once we release v3 (after the Typescript migration). See: |
7dfd34b
to
614a3de
Compare
## [3.0.0-beta.1](v2.3.1...v3.0.0-beta.1) (2023-07-20) ### ⚠ Breaking changes * UNIX standard alignments (#667) ### ✨ Features * UNIX standard alignments ([#667](#667)) ([96ef954](96ef954)) ### ⚙️ Continuous Integrations * add support for beta & maintenance releases ([#677](#677)) ([c6fc842](c6fc842)) * setup conventional commits & release automation ([#673](#673)) ([c6f39ff](c6f39ff)) ### ♻️ Chores * update default branch name ([#678](#678)) ([7471e95](7471e95))
## [3.0.0-beta.1](v2.3.1...v3.0.0-beta.1) (2023-07-20) ### ⚠ Breaking changes * UNIX standard alignments (#667) ### ✨ Features * UNIX standard alignments ([#667](#667)) ([96ef954](96ef954)) ### ⚙️ Continuous Integrations * add support for beta & maintenance releases ([#677](#677)) ([c6fc842](c6fc842)) * setup conventional commits & release automation ([#673](#673)) ([c6f39ff](c6f39ff)) ### ♻️ Chores * update default branch name ([#678](#678)) ([7471e95](7471e95))
## [3.0.0-beta.1](v2.3.1...v3.0.0-beta.1) (2023-07-20) ### ⚠ Breaking changes * UNIX standard alignments (#667) ### ✨ Features * UNIX standard alignments ([#667](#667)) ([96ef954](96ef954)) ### ⚙️ Continuous Integrations * add support for beta & maintenance releases ([#677](#677)) ([c6fc842](c6fc842)) * setup conventional commits & release automation ([#673](#673)) ([c6f39ff](c6f39ff)) ### ♻️ Chores * update default branch name ([#678](#678)) ([7471e95](7471e95))
## [3.0.0-beta.1](v2.3.1...v3.0.0-beta.1) (2023-07-23) ### ⚠ Breaking changes * UNIX standard alignments (#667) ### ✨ Features * UNIX standard alignments ([#667](#667)) ([96ef954](96ef954)) ### ⚙️ Continuous Integrations * add support for beta & maintenance releases ([#677](#677)) ([c6fc842](c6fc842)) * setup conventional commits & release automation ([#673](#673)) ([c6f39ff](c6f39ff)) ### ♻️ Chores * update default branch name ([#678](#678)) ([7471e95](7471e95))
🎉 This PR is included in version 3.0.0-beta.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
## [3.0.0](v2.4.4...v3.0.0) (2023-09-30) ### ⚠ Breaking changes * `utcOffset` parameter no longer accepts a string * `utcOffset` values between -60 and 60 are no longer treated as hours * providing both `timeZone` and `utcOffset` parameters now throws an error * removed `cron.job()` method in favor of `new CronJob(...args)` / `CronJob.from(argsObject)` * removed `cron.time()` method in favor of `new CronTime()` * `CronJob`: constructor no longer accepts an object as its first and only params. Use `CronJob.from(argsObject)` instead. * `CronJob`: callbacks are now called in the order they were registered * return empty array from nextDates when called without argument (#519) * UNIX standard alignments (#667) ### ✨ Features * expose useful types ([737b344](737b344)) * rework utcOffset parameter ([#699](#699)) ([671e933](671e933)) * UNIX standard alignments ([#667](#667)) ([ff615f1](ff615f1)) ### 🐛 Bug Fixes * return empty array from nextDates when called without argument ([#519](#519)) ([c2891ba](c2891ba)) ### 📦 Code Refactoring * migrate to TypeScript ([#694](#694)) ([2d77894](2d77894)) ### 📚 Documentation * **readme:** remove outdated informations ([#695](#695)) ([b5ceaf1](b5ceaf1)) ### 🚨 Tests * update new test for cron standard alignments ([4a406c1](4a406c1)) ### ♻️ Chores * improve GitHub community standards ([#698](#698)) ([6bdef77](6bdef77)) * update contributors list ([dab3d69](dab3d69)) ### 💎 Styles * fix linting issues ([47e665f](47e665f))
Closes #666.
Closes #475.
TODO
month
indexing from0-11 (Jan-Dec)
to1-12 (Jan-Dec)
day-of-week
indexing from0-6 (Sun-Sat)
to0-7 (Sun-Sun)