Skip to content

Incorrect conversion between calendars #341

@devongovett

Description

@devongovett

When converting dates before 1582 to other Gregorian-derived calendars such as buddhist and japanese, the result is incorrect.

Temporal.PlainDate.from({year: 1582, month: 1, day: 1}).withCalendar('buddhist').month
// => 12 (incorrect)

As discussed in tc39/ecma402#1003, all of these calendars should be defined as proleptic - meaning they extend before the Gregorian Calendar was invented in 1582. Therefore, only the year should be changed - the month and day should return 1 in this example.

This is related to browser issues across all JS engines in Intl.DateTimeFormat. Firefox has changed their behavior in 139 beta to match their native Temporal implementation which now returns the correct result.

Temporal.PlainDate.from({year: 1582, month: 1, day: 1}).withCalendar('buddhist').month
// => 1 (correct)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions