mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
LibJS+LibUnicode: Generate missing patterns with fractionalSecondDigits
TR-35's Matching Skeleton algorithm dictates how user requests including
fractional second digits should be handled when the CLDR format pattern
does not include that field. When the format pattern contains {second},
but does not contain {fractionalSecondDigits}, generate a second pattern
which appends "{decimal}{fractionalSecondDigits}" to the {second} field.
This commit is contained in:
committed by
Linus Groh
parent
6ace4000bf
commit
9f7c727720
Notes:
sideshowbarker
2024-07-17 23:05:23 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/9f7c7277201 Pull-request: https://github.com/SerenityOS/serenity/pull/11184
@@ -1,6 +1,3 @@
|
||||
// NOTE: We cannot yet test the fractionalSecondDigits option. There aren't any patterns in the CLDR
|
||||
// with this field ('S' in https://unicode.org/reports/tr35/tr35-dates.html#dfst-second). We
|
||||
// will need to figure out how this field should be generated.
|
||||
describe("correct behavior", () => {
|
||||
test("length is 0", () => {
|
||||
expect(Intl.DateTimeFormat.prototype.resolvedOptions).toHaveLength(0);
|
||||
@@ -179,6 +176,15 @@ describe("correct behavior", () => {
|
||||
});
|
||||
});
|
||||
|
||||
test("fractionalSecondDigits", () => {
|
||||
[1, 2, 3].forEach(fractionalSecondDigits => {
|
||||
const en = new Intl.DateTimeFormat("en", {
|
||||
fractionalSecondDigits: fractionalSecondDigits,
|
||||
});
|
||||
expect(en.resolvedOptions().fractionalSecondDigits).toBe(fractionalSecondDigits);
|
||||
});
|
||||
});
|
||||
|
||||
test("timeZoneName", () => {
|
||||
["short", "long"].forEach(timeZoneName => {
|
||||
const en = new Intl.DateTimeFormat("en", { timeZoneName: timeZoneName });
|
||||
|
||||
Reference in New Issue
Block a user