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

Fewer CalendarDay/CalendarDateFromFields calls during PlainYearMonth add/subtract #2798

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

arshaw
Copy link
Contributor

@arshaw arshaw commented Mar 7, 2024

While investigating for #2794 (ultimately unsuccessful), I uncovered a way to have less user-code calls from PlainYearMonth add/subtract.

I don't see it in the calendar invariants list, but this axiom probably goes without saying: the day before the first day of one month is the last day of the previous month.

If add/subtract moves backward in time, the algorithm requires us to determine the last day of the current month before proceeding with PlainDate-style add/subtract.

Right now, the last day is being determined, but seems unnecessary to thread it back through CalendarDateFromFields, no?

Adjusted tests:
tc39/test262@main...fullcalendar:test262:temporal-fewer-calls-pym-math

Copy link

codecov bot commented Mar 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.60%. Comparing base (02a6d14) to head (fe4ad56).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2798      +/-   ##
==========================================
- Coverage   96.60%   96.60%   -0.01%     
==========================================
  Files          23       23              
  Lines       12312    12304       -8     
  Branches     2272     2272              
==========================================
- Hits        11894    11886       -8     
  Misses        356      356              
  Partials       62       62              

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

@ptomato
Copy link
Collaborator

ptomato commented Apr 18, 2024

After #2826 we should rewrite this to be an editorial PR. Marking as draft for now.

@ptomato ptomato marked this pull request as draft April 18, 2024 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants