Skip to content

fix(date): don't allow parameters <= 0#1536

Merged
Shinigami92 merged 7 commits intonextfrom
fix-date-parameters-with-zero
Nov 9, 2022
Merged

fix(date): don't allow parameters <= 0#1536
Shinigami92 merged 7 commits intonextfrom
fix-date-parameters-with-zero

Conversation

@Shinigami92
Copy link
Copy Markdown
Member

While working on #1534 I found this bug and extracted it to this PR.

Before this fix, values === 0 would be treated as falsy value and fallback to 1.
We want to prevent this behavior directly and now throw an error when the user tries to use values below or equals to 0.

@Shinigami92 Shinigami92 added c: bug Something isn't working p: 1-normal Nothing urgent m: date Something is referring to the date module labels Nov 7, 2022
@Shinigami92 Shinigami92 added this to the v8.0 - Module Re-Shuffling milestone Nov 7, 2022
@Shinigami92 Shinigami92 self-assigned this Nov 7, 2022
Comment thread src/modules/date/index.ts Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 7, 2022

Codecov Report

Merging #1536 (6ba5fb2) into next (5a09c89) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Additional details and impacted files
@@           Coverage Diff           @@
##             next    #1536   +/-   ##
=======================================
  Coverage   99.64%   99.64%           
=======================================
  Files        2214     2214           
  Lines      238725   238741   +16     
  Branches     1015     1023    +8     
=======================================
+ Hits       237869   237885   +16     
  Misses        835      835           
  Partials       21       21           
Impacted Files Coverage Δ
src/modules/date/index.ts 99.14% <100.00%> (+0.04%) ⬆️

@Shinigami92 Shinigami92 marked this pull request as ready for review November 8, 2022 16:31
@Shinigami92 Shinigami92 requested a review from a team as a code owner November 8, 2022 16:31
@Shinigami92 Shinigami92 requested a review from ejcheng November 8, 2022 16:32
ST-DDT
ST-DDT previously approved these changes Nov 8, 2022
Copy link
Copy Markdown
Member

@ST-DDT ST-DDT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As an alternative we could treat the <=0 as zero returning effectively now/refDate (minus/plus 1 second to be in the past/future).

Comment thread test/date.spec.ts
@Shinigami92
Copy link
Copy Markdown
Member Author

As an alternative we could treat the <=0 as zero returning effectively now/refDate (minus/plus 1 second to be in the past/future).

IMO this is not directly part of this issue. I would like to have this fixed to proceed with #1534.
But yeah, we can talk about this in next meeting in general, but would like to prio it down in the agenda so we have more focus on other more important things already on the agenda.

@ST-DDT ST-DDT requested review from a team November 8, 2022 23:10
@Shinigami92 Shinigami92 requested a review from a team November 9, 2022 16:48
@Shinigami92 Shinigami92 enabled auto-merge (squash) November 9, 2022 18:40
@Shinigami92 Shinigami92 merged commit dd58148 into next Nov 9, 2022
@ST-DDT ST-DDT deleted the fix-date-parameters-with-zero branch November 9, 2022 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c: bug Something isn't working m: date Something is referring to the date module p: 1-normal Nothing urgent

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants