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

fix: Add support for the new Japanese Era (Reiwa) to ICU #17833

Merged

Conversation

Projects
None yet
7 participants
@jefgen
Copy link

commented Apr 17, 2019

Description of Change

This change backports changes from the upstream ICU project's maintenance release for ICU 62.2 in order to enable support for the new Japanese Era "Reiwa" in Chromium 69 (which uses ICU version 62.1).

Upstream release: http://site.icu-project.org/download/62

Background information:

The current Japanese Emperor will abdicate on April 30, 2019. The current era Heisei (平成) will end on that date, and a new Japanese era Reiwa (令和) will start on May 1, 2019. Until the end of April, the year in Japanese calendar is Heisei 31 (平成31年), but from May 1 on it will be changed to Reiwa 1 (令和元年).

Existing ICU versions support Japanese calendar date calculation and formatting, but the new era Reiwa was not known when these versions were released. Therefore, these ICU versions produce an incorrect year format when using the Japanese calendar, which is the default calendar for the Japanese locale.

This PR removes the patch for the "placeholder" era name support that was added in PR #17518, and replaces it with a new patch that adds support for the official new era name, and bumps the ICU version from 62.1 to 62.2.

With this change you now get correct results for various JavaScript date/time formatting APIs for the Japanese calendar.

Additionally, this PR also backports some additional bug fixes from upstream as well.

This PR also includes the following fixes/updates:

  • Update IANA time zone data to tzdata2019a.
  • Japanese calendar: era calculation should use local time, not UTC.
  • Japanese calendar: use all valid eras for calendar calculations.
  • Fix LocalMemory move constructor deletion issue.

This change requires re-generating the checked-in Chromium ICU data files (ex: icudtl.dat) in order for them to have the updated data for the new era name.
Note: All of the checked-in files are be regenerated, even though the Electron project only uses the "common" one.

Screenshots:

Before, with the placeholder era not enabled. (Incorrectly showing dates after May 1 2019 using the Heisei era).
image

After, correctly using the new era Reiwa for dates after April 30, 2019.
image

You can also see the version bump for icu and tz in the screenshot.

Sample code (for testing):

<p>Outputs:</p>
<form>
<textarea id="jaEraOutputs" rows="9" cols="60"></textarea>
</form>

<script type="text/javascript">
    // Heisi Era will end on April 30, 2019 so pick a date before.
    var dateHeisi = new Date(Date.UTC(2019, 01, 15, 3, 0, 0));
    // New Era starts on May 1, 2019.
    var dateNew = new Date(Date.UTC(2019, 05, 02, 3, 0, 0));
    
    var out = document.getElementById("jaEraOutputs");
    out.value = "";
    out.value += "Heisi: \n";
    out.value += "\t ja-JP:  " + dateHeisi.toLocaleString('ja-JP-u-ca-japanese', {era: 'long'}) + "\n";
    out.value += "\t en-US:  " + dateHeisi.toLocaleString('en-US-u-ca-japanese', {era: 'long'}) + "\n";
    out.value += "\n";
    out.value += "New Era: \n";
    out.value += "\t ja-JP:  " + dateNew.toLocaleString('ja-JP-u-ca-japanese', {era: 'long'}) + "\n";
    out.value += "\t en-US:  " + dateNew.toLocaleString('en-US-u-ca-japanese', {era: 'long'}) + "\n";
</script>

Checklist

Release Notes

Notes:

  • Added support for the new Japanese Era Reiwa (令和) to JavaScript date/time formatting APIs.
  • Updated ICU library to version 62.2
  • Updated IANA time zone data to tzdata2019a.
fix: Add support for the new Japanese Era (Reiwa) to ICU
This change backports changes from the upstream ICU project's
maintenance release for ICU 62.2 in order to enable support for the new
Japanese Era "Reiwa" in Chromium 69 (which uses ICU version 62.1).

Upstream release: http://site.icu-project.org/download/62

Additionally, this change also includes the following fixes/updates:
 - Update IANA time zone tzdata to 2019a.
 - Japanese calendar era calculation should use local time, not UTC.
 - Japanese calendar: use all valid eras for calendar calculations.
 - Fix LocalMemory move constructor delete issue.

This change requires re-generating the checked-in Chromium ICU data
files (ex: icudtl.dat) in order for them to have the updated data for
the new era name. However, that will be done with a separate commit in
order to make the ".patch" files cleaner.

Note: All of the checked-in files are be regenerated, even though
the Electron project only uses the "common" one.

Also included in this change are some minor changes to the scripts used
by Chromium for building the data files so that they actually work on
Ubuntu.

@electron-cation electron-cation bot added new-pr 🌱 and removed new-pr 🌱 labels Apr 17, 2019

@deepak1556
Copy link
Member

left a comment

Related upstream PR: unicode-org/icu#610

@miniak

miniak approved these changes Apr 19, 2019

@codebytere codebytere merged commit 9ed83e7 into electron:4-1-x Apr 19, 2019

8 checks passed

Artifact Comparison No Changes
Details
Semantic Pull Request ready to be squashed
Details
WIP Ready for review
Details
appveyor: win-ia32-testing-pr AppVeyor build succeeded
Details
appveyor: win-x64-testing-pr AppVeyor build succeeded
Details
build-linux Workflow: build-linux
Details
build-mac Workflow: build-mac
Details
release-notes Release notes found
@release-clerk

This comment has been minimized.

Copy link

commented Apr 19, 2019

Release Notes Persisted

  • Added support for the new Japanese Era Reiwa (令和) to JavaScript date/time formatting APIs.
  • Updated ICU library to version 62.2
  • Updated IANA time zone data to tzdata2019a.
@omarkilani

This comment has been minimized.

Copy link

commented Apr 25, 2019

@jefgen is a similar fix needed on the 5.x branch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.