Closed sheerlox closed 1 year ago
cc @rharshit82 for review/comments since you authored #685 :wink:
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 utcOffset
number into the sign, hours, and minutes it's a little tricky to understand what's going on. there's some if/else logic and some ternary logic and it's not super obvious what the final format should be. I would prefer if the sign, hours, and minutes were all parsed separately and then all combined into a template literal at the very end
@intcreator addressed your concerns in the last commit :wink:
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
:tada: This PR is included in version 3.0.0-beta.9 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
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 https://github.com/kelektiv/node-cron/pull/685#issuecomment-1676394391 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 string BREAKING CHANGE:utcOffset
values between -60 and 60 are no longer treated as hours BREAKING CHANGE: providing bothtimeZone
andutcOffset
parameters now throws an error