Skip to content
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

refactor(date)!: fail on invalid dates #2757

Merged
merged 11 commits into from
Mar 24, 2024
Merged

Conversation

ST-DDT
Copy link
Member

@ST-DDT ST-DDT commented Mar 15, 2024

If a given date is invalid, it is treated as an error instead of falling back to refDateSource

@ST-DDT ST-DDT added p: 1-normal Nothing urgent c: refactor PR that affects the runtime behavior, but doesn't add new features or fixes bugs breaking change Cannot be merged when next version is not a major release m: date Something is referring to the date module labels Mar 15, 2024
@ST-DDT ST-DDT added this to the v9.0 milestone Mar 15, 2024
@ST-DDT ST-DDT self-assigned this Mar 15, 2024
Copy link

netlify bot commented Mar 15, 2024

Deploy Preview for fakerjs ready!

Name Link
🔨 Latest commit dca3569
🔍 Latest deploy log https://app.netlify.com/sites/fakerjs/deploys/660020fd0300ae00082f30aa
😎 Deploy Preview https://deploy-preview-2757.fakerjs.dev
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Mar 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.94%. Comparing base (45150d1) to head (dca3569).

Additional details and impacted files
@@            Coverage Diff             @@
##             next    #2757      +/-   ##
==========================================
+ Coverage   99.92%   99.94%   +0.01%     
==========================================
  Files        2958     2958              
  Lines      213713   213686      -27     
  Branches      947      949       +2     
==========================================
+ Hits       213560   213569       +9     
+ Misses        153      117      -36     
Files Coverage Δ
src/modules/date/index.ts 100.00% <100.00%> (+0.17%) ⬆️

... and 2 files with indirect coverage changes

@ST-DDT ST-DDT marked this pull request as ready for review March 15, 2024 22:10
@ST-DDT ST-DDT requested a review from a team as a code owner March 15, 2024 22:10
@ST-DDT ST-DDT requested a review from a team March 15, 2024 22:10
docs/guide/upgrading_v9/2757.md Outdated Show resolved Hide resolved
src/modules/date/index.ts Outdated Show resolved Hide resolved
src/modules/date/index.ts Show resolved Hide resolved
@ST-DDT ST-DDT requested a review from Shinigami92 March 17, 2024 09:48
Copy link
Member

@Shinigami92 Shinigami92 left a comment

Choose a reason for hiding this comment

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

I wondered why the snapshots are different, but this is due to not calling date.setTime(future/past) anymore. This is okay to me, as it is still on the same Day, but just a different time.

So there is only one thing we can improve in the vitest test, and then I'm okay with approving this

test/modules/date.spec.ts Outdated Show resolved Hide resolved
@ST-DDT
Copy link
Member Author

ST-DDT commented Mar 19, 2024

I wondered why the snapshots are different, but this is due to not calling date.setTime(future/past) anymore. This is okay to me, as it is still on the same Day, but just a different time.

Both date and time are different for all methods in the past. Because we now generate the range directly instead of subtracting it. So the result is basically flipped.

src/modules/date/index.ts Outdated Show resolved Hide resolved
@ST-DDT ST-DDT requested review from matthewmayer, Shinigami92 and a team March 23, 2024 23:17
@xDivisionByZerox xDivisionByZerox enabled auto-merge (squash) March 24, 2024 12:48
@xDivisionByZerox xDivisionByZerox merged commit 3485e7e into next Mar 24, 2024
20 checks passed
@xDivisionByZerox xDivisionByZerox deleted the refactor/date/toDate branch March 24, 2024 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Cannot be merged when next version is not a major release c: refactor PR that affects the runtime behavior, but doesn't add new features or fixes bugs m: date Something is referring to the date module p: 1-normal Nothing urgent
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants