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

test(datetime): test each part type in dateTimeFormatter.format #6516

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

WWRS
Copy link
Contributor

@WWRS WWRS commented Mar 25, 2025

Previously, larger tests meant these appeared to be covered, but there was no testing of the deep specifications for each part type. Covering the cases revealed a bug with fractionalSecond, and the fix is included in this PR.

I also made formatToParts require exactly 2 digits when parsing yy and exactly 4 digits when parsing yyyy instead of 1-2 or 1-4 respectively. The spec requires yy to represent exactly 2 digits, but yyyy technically represents 4+ digits. In neither case are fewer digits allowed. I think it's unlikely anyone will be trying to parse years with 5+ digits, and parsing yyyyMMdd would require a more sophisticated approach if we allowed 5+, so I think only allowing 4 is best.

@WWRS WWRS requested a review from kt3k as a code owner March 25, 2025 15:30
Copy link

codecov bot commented Mar 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.30%. Comparing base (96116ce) to head (f086791).
Report is 24 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6516      +/-   ##
==========================================
- Coverage   95.50%   95.30%   -0.21%     
==========================================
  Files         575      576       +1     
  Lines       43279    43326      +47     
  Branches     6472     6483      +11     
==========================================
- Hits        41335    41290      -45     
- Misses       1905     1995      +90     
- Partials       39       41       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant