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

Next batch of editorial issues #2934

Merged
merged 15 commits into from
Sep 12, 2024
Merged

Next batch of editorial issues #2934

merged 15 commits into from
Sep 12, 2024

Commits on Sep 11, 2024

  1. Tests: Fix setup code in test file

    If running this test file without first importing the proposal polyfill,
    it would fail due to the new intrinsics not being defined. We never
    noticed this because we usually run datemath.mjs before this file.
    ptomato committed Sep 11, 2024
    Configuration menu
    Copy the full SHA
    be3c64d View commit details
    Browse the repository at this point in the history
  2. Polyfill: Perform eraYear checks only if calendar has eras

    In the calendar-specific code, in isoToCalendarDate(), we should not be
    computing the era year if the calendar doesn't have eras.
    ptomato committed Sep 11, 2024
    Configuration menu
    Copy the full SHA
    a342f77 View commit details
    Browse the repository at this point in the history
  3. Polyfill: Ignore eraYear in calendars without eras

    In 'hebrew', 'chinese', and 'dangi' calendars, there are no eras. Any
    eraYear property given in calendar fields must be ignored, as per
    CalendarResolveFields in the spec text. Adjust the helpers for Hebrew and
    Chinese/Dangi calendars accordingly; the eraYear was being used in place
    of the year in some cases.
    
    Closes: #2870
    ptomato committed Sep 11, 2024
    Configuration menu
    Copy the full SHA
    f2f503a View commit details
    Browse the repository at this point in the history
  4. Editorial: Use calendar addition to calculate weeks start

    This was an overzealous replacement of CalendarDateAdd with BalanceISODate
    spotted by Anba. It doesn't produce any observably different results,
    because in all supported calendars weeks are always 7 days; but it's still
    conceptually incorrect. Go back to using CalendarDateAdd here.
    
    Closes: #2881
    ptomato committed Sep 11, 2024
    Configuration menu
    Copy the full SHA
    ff962ee View commit details
    Browse the repository at this point in the history
  5. Editorial: Fix typo in loop comparison operator

    Otherwise the loop would not run.
    
    Closes: #2890
    ptomato committed Sep 11, 2024
    Configuration menu
    Copy the full SHA
    c04771d View commit details
    Browse the repository at this point in the history
  6. Editorial: Simplify early return condition in BubbleRelativeDuration

    As pointed out by Anba, this AO does nothing if smallestUnit equals
    largestUnit, not just if smallestUnit equals "year". We can simplify the
    early return condition.
    
    See: #2890
    ptomato committed Sep 11, 2024
    Configuration menu
    Copy the full SHA
    3595dbd View commit details
    Browse the repository at this point in the history
  7. Editorial: Remove dead clause in BubbleRelativeDuration

    smallestUnit is a date unit. In the loop, unitIndex runs from the index
    before smallestUnit and is decremented, meaning that unit can only ever be
    "year", "month", or "week".
    
    Thanks to Anba for spotting this.
    
    See: #2890
    ptomato committed Sep 11, 2024
    Configuration menu
    Copy the full SHA
    145837a View commit details
    Browse the repository at this point in the history
  8. Editorial: Use ToIntegerWithTruncation in GetRoundingIncrementOption

    Same thing, just shorter and clearer.
    
    Closes: #2923
    ptomato committed Sep 11, 2024
    Configuration menu
    Copy the full SHA
    51c0530 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    4a13640 View commit details
    Browse the repository at this point in the history
  10. Editorial: Remove unthrowable exception from duration rounding

    It's not possible for the duration to not be valid here, as _duration_ is
    a valid duration, and the duration being tested is _duration_ truncated to
    days, which can only ever be less than _duration_.
    
    Spotted by Anba.
    
    Closes: #2880
    ptomato committed Sep 11, 2024
    Configuration menu
    Copy the full SHA
    9b2b18e View commit details
    Browse the repository at this point in the history
  11. Polyfill: Remove eras from buddhist, ethioaa, indian, islamic*, persi…

    …an calendars
    
    Dates in these calendars display an era when they are formatted in English
    using Intl.DateTimeFormat, but not when they are formatted for the region
    where the calendar is used. That likely indicates they shouldn't have
    eras.
    
    Remove `constantEra` from the calendar helpers, and introduce a new helper
    that calculates dates relative to a fixed year zero.
    
    Closes: #2899
    ptomato committed Sep 11, 2024
    Configuration menu
    Copy the full SHA
    6969559 View commit details
    Browse the repository at this point in the history
  12. Polyfill: Implement era aliases

    As of the current state of the Intl Era and Month Codes proposal, the
    eras table in https://tc39.es/proposal-intl-era-monthcode/#table-eras has
    a canonical name for each era, and a number of aliases which should also
    be accepted. Legacy ICU names such as "era0" should not be accepted,
    although they still need to be handled when using Intl.DateTimeFormat to
    convert dates.
    
    Closes: #2901
    ptomato committed Sep 11, 2024
    Configuration menu
    Copy the full SHA
    14b3060 View commit details
    Browse the repository at this point in the history
  13. Polyfill: Save a few property copies in calendar helpers

    The makeHelper___() functions already return a new object, so we don't
    need to Object.assign() them to {}.
    ptomato committed Sep 11, 2024
    Configuration menu
    Copy the full SHA
    aa98260 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    0e74b87 View commit details
    Browse the repository at this point in the history
  15. Update test262

    ptomato committed Sep 11, 2024
    Configuration menu
    Copy the full SHA
    a5cc2c1 View commit details
    Browse the repository at this point in the history