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

Normative: Treat daysInMonth as the count of days in a month #2484

Merged
merged 2 commits into from
Apr 28, 2023

Conversation

cjtenny
Copy link
Collaborator

@cjtenny cjtenny commented Jan 19, 2023

Addresses #1315.

Updates Plain Year Month arithmetic to use a version of .with({ day: 1 }).add({ months: 1 }).subtract({ days: 1}).day to get the index of the last day of the month. Chose this over the alternative of .with({ day: 1 }).add({ days: yearMonth.daysInMonth() - 1]}).day beacuse the GetMethod(calendar, "dateAdd") can be reduced to one GetMethod.

Updates polyfill, no changes needed to non-ISO calendars because there are no skipped days in any of the calendars it implements.

Updates to docs pending, will update PR when ready.

Will prepare separate editorial PR to make language of CalendarDateDaysIn{Week,Month,Year} and CalendarDateMonthsInYear more consistent, but current phrasing is correct - nothing needed to address this.

@codecov
Copy link

codecov bot commented Jan 19, 2023

Codecov Report

Merging #2484 (c4d83ae) into main (d1161a1) will increase coverage by 0.01%.
The diff coverage is 100.00%.

❗ Current head c4d83ae differs from pull request most recent head e604f37. Consider uploading reports for the commit e604f37 to get more accurate results

@@            Coverage Diff             @@
##             main    #2484      +/-   ##
==========================================
+ Coverage   96.16%   96.17%   +0.01%     
==========================================
  Files          20       20              
  Lines       11289    11300      +11     
  Branches     2163     2164       +1     
==========================================
+ Hits        10856    10868      +12     
  Misses        369      369              
+ Partials       64       63       -1     
Impacted Files Coverage Δ
polyfill/lib/ecmascript.mjs 98.17% <100.00%> (+<0.01%) ⬆️

... and 1 file with indirect coverage changes

Copy link
Collaborator

@ptomato ptomato left a comment

Choose a reason for hiding this comment

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

Thanks! A few minor comments. Looking forward to the docs and non-ISO calendars changes.

polyfill/lib/ecmascript.mjs Outdated Show resolved Hide resolved
polyfill/lib/ecmascript.mjs Outdated Show resolved Hide resolved
spec/plainyearmonth.html Outdated Show resolved Hide resolved
…r of the last day

Updates PlainYearMonth arithmetic accordingly and clarifies language
around non-ISO calendar operations.

Fixes #1315

Co-authored-by: Guillaume Emont <guijemont@igalia.com>
@ptomato ptomato marked this pull request as ready for review April 28, 2023 19:15
@ptomato
Copy link
Collaborator

ptomato commented Apr 28, 2023

This PR reached consensus in the January 2023 TC39 meeting.

@ptomato ptomato merged commit 31656b1 into main Apr 28, 2023
@ptomato ptomato deleted the dayInMonthIsCount branch April 28, 2023 19:25
@justingrant
Copy link
Collaborator

Looking forward to the docs and non-ISO calendars changes.

Is there already an issue created for docs and non-ISO calendars?

justingrant added a commit that referenced this pull request May 2, 2023
Replaces a use of `ObjectCreate` followed by `CopyDataProperties` with `CopyOptions`.

This pattern is used everywhere else in Temporal but was missed in #2484.
Ms2ger pushed a commit that referenced this pull request May 2, 2023
Replaces a use of `ObjectCreate` followed by `CopyDataProperties` with `CopyOptions`.

This pattern is used everywhere else in Temporal but was missed in #2484.
@ptomato
Copy link
Collaborator

ptomato commented May 2, 2023

I had determined along the line somewhere that they didn't seem necessary, but if you see some then please do open an issue.

moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Jul 18, 2023
…earMonth. r=spidermonkey-reviewers,sfink

Implement the changes from <tc39/proposal-temporal#2484>.

Differential Revision: https://phabricator.services.mozilla.com/D182049
ErichDonGubler pushed a commit to erichdongubler-mozilla/firefox that referenced this pull request Jul 19, 2023
…earMonth. r=spidermonkey-reviewers,sfink

Implement the changes from <tc39/proposal-temporal#2484>.

Differential Revision: https://phabricator.services.mozilla.com/D182049
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Jul 21, 2023
…earMonth. r=spidermonkey-reviewers,sfink

Implement the changes from <tc39/proposal-temporal#2484>.

Differential Revision: https://phabricator.services.mozilla.com/D182049

UltraBlame original commit: 2aff072a94c4b7ae26778e7308f853ab008bd8e2
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Jul 21, 2023
…earMonth. r=spidermonkey-reviewers,sfink

Implement the changes from <tc39/proposal-temporal#2484>.

Differential Revision: https://phabricator.services.mozilla.com/D182049

UltraBlame original commit: 2aff072a94c4b7ae26778e7308f853ab008bd8e2
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Jul 21, 2023
…earMonth. r=spidermonkey-reviewers,sfink

Implement the changes from <tc39/proposal-temporal#2484>.

Differential Revision: https://phabricator.services.mozilla.com/D182049

UltraBlame original commit: 2aff072a94c4b7ae26778e7308f853ab008bd8e2
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.

3 participants