-
Notifications
You must be signed in to change notification settings - Fork 108
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: Improve handling of non-Gregorian calendars #227
Conversation
Should relatedYear be in |
I guess I agree with @jackhorton's comment from above when looking at the description of 'r' at https://unicode.org/repos/cldr/trunk/specs/ldml/tr35-dates.html#dfst-year. That means if it is supported it should not be an input option and the value should not be |
I just used long/short as a copypasta error. 2-digit/numeric seems right to me. Fixed. |
Is there anything else needed to verify this patch before landing? (I don't see how we can write test262 tests for it, unfortunately, unless tests are allowed to depend on some locale data.) |
Yes, there's still more work to do. 😄
From my earlier comment:
|
I believe on the call we concluded that the year name would be treated as |
In the May 2018 Intl call, we concluded:
The patch was discussed in the presentation at the May 2018 TC39 meeting, with no concerns raised, so I believe it has consensus with the committee.
What's your reasoning here? I thought we were switching to unversioned Unicode references. cc @mathiasbynens
Yes, looks like we need an update, seems pretty straightforward. @jackhorton I'm not sure what you mean. |
Sorry, I was trying to answer "Will there be a similar issue for the cyclic year name "U"?" by saying that my understanding was the consensus was that |
As discussed yesterday, I think we rather want to use the link https://unicode.org/reports/tr35/tr35-dates.html#dfst-year, which seems to be the stable link to the latest released version of UTR 35. |
d8f9ed3
to
d476d6f
Compare
Last time we discussed this issue, we reached consensus on making the change, and were just waiting for an implementation to merge the patch. Has anyone implemented it and written tests, or think they will do so soon? It's now more practical to write tests than previously due to the test262 |
- Specify that a CLDR-style schema* and ICU-style logic for how the pattern is chosen based on the dateStyle and timeStyle parameters, rather than being entirely implementation-defined. Closes #3 - Rebase against master and modernize the specification editorially; remove unchanged specification sections. Closes #5 This patch implies that OS options are not taken into account when using dateStyle/timeStyle; the data instead comes from a source like CLDR. * The schema here omits that the patterns are calendar-specific. The fix is out for review in tc39/ecma402#227 .
I try to implement this PR in v8 and I believe it does not produce meaningful result. Now, after step 22 we will also get It seems 'r' is not for skeleton but pattern
but notice 'r' is not on the left side (the skeleton) but only appeared in the right side (the pattern) |
Interesting, thanks for the analysis. Should we remove relatedYear as an option and only permit it in the formatToParts output then? Cc @Ms2ger. |
In CLDR, the set of patterns is based on the the calendar, not simply the language-region-script. Previously, however, the set was based purely on the base name. This patch switches to a two-level lookup to permit implementations to have more accuracy. The patch adds an additional field to DateTimeFormat: relatedYear. This is the related Gregorian year, e.g., as used in some Chinese calendar formats when the Gregorial year is put next to the year in a 60-year cycle. The patch makes an editorial change to make the descriptions of the locale database fully switch to records (there was some object-style notation remaining). Closes tc39#225
- Point to more appropriate UTS35 version - Include relatedYear in ToLocalTime - Only permit numeric, not 2-digit, for relatedYear
Pushed a new PR that omits relatedYear as an option and in resolvedOptions. PTAL. |
spec/datetimeformat.html
Outdated
@@ -303,6 +304,10 @@ <h1>PartitionDateTimePattern ( _dateTimeFormat_, _x_ )</h1> | |||
1. Else, | |||
1. Let _fv_ be an implementation and locale dependent String value representing `"ante meridiem"`. | |||
1. Add new part record { [[Type]]: `"dayPeriod"`, [[Value]]: _fv_ } as a new element of the list _result_. | |||
1. Else if _p_ is equal to `"relativeYear"`, then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be relativeYear or relatedYear ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops! Fixed.
I think this current PR need some improvement. r and U are often appear together in the pattern and I think when we deal with r we also need to deal with U. Here is the example
in the above code, after considering the calendar for getting the pattern, we got
so the pattern is "r(U)"
notice "2019" is the r:relatedYear, and "ji-hai" is the U "cyclic year name, as in Chinese lunar calendar" now, for formatToParts, what should the output of dtf.formatToParts(d); ?
and treat the U the same way as y ? to report the "ji-hai" part as "year"? or should we report it differently? |
v8 prototype in https://chromium-review.googlesource.com/c/v8/v8/+/1588401 |
relatedYear is only present in the pattern, not the skeleton, so it is omitted from the options bag as well as resolvedOptions.
@FrankYFTang Do you think we should give it a different part name? What should that part name be? |
I think so. How about "yearName"? The ICU enum for that is UDAT_YEAR_NAME_FIELD |
Here is my prototype in v8
This is more than what you spec in the current change, it also add the "yearName" as the output of ToLocalTime. |
If you want to upload a revised PR, I am happy to review it. Otherwise, I plan to fix this to match those semantics soon. |
In CLDR, the set of patterns is based on the the calendar, not simply the language-region-script. Previously, however, the set was based purely on the base name. This patch switches to a two-level lookup to permit implementations to have more accuracy. Splitting off part of tc39#227. Fixes part of tc39#225.
The patch makes an editorial change to make the descriptions of the locale database fully switch to records (there was some object-style notation remaining). Split off from tc39#227
The patch makes an editorial change to make the descriptions of the locale database fully switch to records (there was some object-style notation remaining). Split off from #227
In CLDR, the set of patterns is based on the the calendar, not simply the language-region-script. Previously, however, the set was based purely on the base name. This patch switches to a two-level lookup to permit implementations to have more accuracy. Splitting off part of tc39#227. Fixes part of tc39#225.
In CLDR, the set of patterns is based on the the calendar, not simply the language-region-script. Previously, however, the set was based purely on the base name. This patch switches to a two-level lookup to permit implementations to have more accuracy. Splitting off part of tc39#227. Fixes part of tc39#225.
In CLDR, the set of patterns is based on the the calendar, not simply the language-region-script. Previously, however, the set was based purely on the base name. This patch switches to a two-level lookup to permit implementations to have more accuracy. Splitting off part of #227. Fixes part of #225.
In CLDR, the set of patterns is based on the the calendar, not
simply the language-region-script. Previously, however, the set
was based purely on the base name. This patch switches to a two-level
lookup to permit implementations to have more accuracy.
The patch adds an additional field to DateTimeFormat: relatedYear.
This is the related Gregorian year, e.g., as used in some Chinese calendar
formats when the Gregorial year is put next to the year in a 60-year cycle.
The patch makes an editorial change to make the descriptions
of the locale database fully switch to records (there was some object-style
notation remaining).
Closes #225