-
Notifications
You must be signed in to change notification settings - Fork 627
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!: rework utcOffset parameter #699
Conversation
BREAKING CHANGE: `utcOffset` parameter no longer accepts a string BREAKING CHANGE: `utcOffset` values between -60 and 60 are no longer treated as hours
cc @rharshit82 for review/comments since you authored #685 😉 |
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.
The changes look good to me. In future, we can break the sendAt function into several smaller methods to improve clarity and maintainability but that is out of scope for TS migration for now.
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.
the parsing logic for utcOffset
is still a little confusing but fixing it might be out of scope for this PR
@intcreator can you expand on that? I'm going to restrict the type so if I can do something while at it let me know! |
so that's a different issue than the type, it's just when parsing the |
BREAKING CHANGE: using both timeZone and utcOffset now throws an error
@intcreator addressed your concerns in the last commit 😉 |
I love the refactored UTC string builder! very easy to tell what's going on now. I have a small nitpick which is just a naming thing and not a blocker to merging the PR |
## [3.0.0-beta.9](v3.0.0-beta.8...v3.0.0-beta.9) (2023-09-29) ### ⚠ 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 ### ✨ Features * rework utcOffset parameter ([#699](#699)) ([72d3d36](72d3d36)) ### ♻️ Chores * improve GitHub community standards ([#698](#698)) ([6bdef77](6bdef77)) ### 💎 Styles * fix linting issues ([b48c1b2](b48c1b2))
🎉 This PR is included in version 3.0.0-beta.9 🎉 The release is available on: Your semantic-release bot 📦🚀 |
## Breaking changes BREAKING CHANGE: `utcOffset` parameter no longer accepts a string BREAKING CHANGE: `utcOffset` values between -60 and 60 are no longer treated as hours BREAKING CHANGE: providing both `timeZone` and `utcOffset` parameters now throws an error
## Breaking changes BREAKING CHANGE: `utcOffset` parameter no longer accepts a string BREAKING CHANGE: `utcOffset` values between -60 and 60 are no longer treated as hours BREAKING CHANGE: providing both `timeZone` and `utcOffset` parameters now throws an error
## Breaking changes BREAKING CHANGE: `utcOffset` parameter no longer accepts a string BREAKING CHANGE: `utcOffset` values between -60 and 60 are no longer treated as hours BREAKING CHANGE: providing both `timeZone` and `utcOffset` parameters now throws an error
## Breaking changes BREAKING CHANGE: `utcOffset` parameter no longer accepts a string BREAKING CHANGE: `utcOffset` values between -60 and 60 are no longer treated as hours BREAKING CHANGE: providing both `timeZone` and `utcOffset` parameters now throws an error
## Breaking changes BREAKING CHANGE: `utcOffset` parameter no longer accepts a string BREAKING CHANGE: `utcOffset` values between -60 and 60 are no longer treated as hours BREAKING CHANGE: providing both `timeZone` and `utcOffset` parameters now throws an error
## [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))
Description
This PR aims to make the
utcOffset
parameter behavior more explicit.Before these changes, strings were accepted and resulted in unpredictable behavior due to the comparison of string & number and the
parseInt
method being used. See #685 (comment) for more details.utcOffset
between-60
and+60
were treated as hours behind the scenes, which wasn't initially documented.Changes introduced:
utcOffset
must now be a string, and will always be treated as minutes.Motivation and Context
These changes follow the discussions on #685 about the poor design choices made while this parameter was implemented.
How Has This Been Tested?
Test suites.
Types of changes
Checklist:
!
after the type/scope in the title (see the Conventional Commits standard).Breaking changes
BREAKING CHANGE:
utcOffset
parameter no longer accepts a stringBREAKING CHANGE:
utcOffset
values between -60 and 60 are no longer treated as hoursBREAKING CHANGE: providing both
timeZone
andutcOffset
parameters now throws an error