-
Notifications
You must be signed in to change notification settings - Fork 625
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
fix: fix range parsing when upper limit = 0 #687
Conversation
I'm not sure whether to consider this as a breaking change or not 🤔 On one hand, it will break the code of anyone using ranges like So I'd be tempted to say we release this as a fix and not as a breaking change, wdyt? |
I think because it's not documented to work the way that it does it shouldn't be considered a breaking change. it was never officially acknowledged as being part of the API. so my vote is bug fix over breaking change. you shouldn't depend on undefined behavior in your code |
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.
I know it's fixing a bug but I think being explicit helps the code be more readable. it's possible we might could use ??
here instead of ||
and &&
but since we want a boolean anyway I think your change is best
tests look good too!
🎉 This PR is included in version 2.4.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
## [3.0.0-beta.4](v3.0.0-beta.3...v3.0.0-beta.4) (2023-09-10) ### 🐛 Bug Fixes * **deps:** update dependency luxon to v3.3.0 & add [@types](https://github.com/types)/luxon ([#689](#689)) ([c95a449](c95a449)), closes [#688](#688) * fix range parsing when upper limit = 0 ([#687](#687)) ([d96746f](d96746f)) ### 🚨 Tests * add TS types check ([#690](#690)) ([f046016](f046016))
🎉 This PR is included in version 3.0.0-beta.4 🎉 The release is available on: Your semantic-release bot 📦🚀 |
## [2.4.3](kelektiv/node-cron@v2.4.2...v2.4.3) (2023-08-26) ### 🐛 Bug Fixes * fix range parsing when upper limit = 0 ([#687](kelektiv/node-cron#687)) ([d96746f](kelektiv/node-cron@d96746f)) ### 🚨 Tests * add TS types check ([#690](kelektiv/node-cron#690)) ([f046016](kelektiv/node-cron@f046016))
## [2.4.3](kelektiv/node-cron@v2.4.2...v2.4.3) (2023-08-26) ### 🐛 Bug Fixes * fix range parsing when upper limit = 0 ([kelektiv#687](kelektiv#687)) ([d96746f](kelektiv@d96746f)) ### 🚨 Tests * add TS types check ([kelektiv#690](kelektiv#690)) ([f046016](kelektiv@f046016))
## [2.4.3](kelektiv/node-cron@v2.4.2...v2.4.3) (2023-08-26) ### 🐛 Bug Fixes * fix range parsing when upper limit = 0 ([kelektiv#687](kelektiv#687)) ([d96746f](kelektiv@d96746f)) ### 🚨 Tests * add TS types check ([kelektiv#690](kelektiv#690)) ([f046016](kelektiv@f046016))
Description
When providing the invalid value
0
as the upper limit in a range (e.g.2-0
), the library was not detecting the error due to the use of the||
operator, which considers0
&undefined
the same way.I have replaced the operator to check specifically for
undefined
in order to detect the invalid value0
.Related Issue
Fixes #654.
How Has This Been Tested?
I have extended an existing test case to check for invalid ranges and added a test case that checks all valid ranges are accepted.
Types of changes
Checklist:
!
after the type/scope in the title (see the Conventional Commits standard).