mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:17:35 +00:00
LibJS: Change digital default style from "narrow" to "short"
This is a normative change in the Intl.DurationFormat proposal. See:
4c24876
This commit is contained in:
parent
51854e345a
commit
60a6bae53d
3 changed files with 13 additions and 13 deletions
|
@ -204,10 +204,10 @@ static constexpr AK::Array<StringView, 3> date_values = { "long"sv, "short"sv, "
|
||||||
static constexpr AK::Array<StringView, 5> time_values = { "long"sv, "short"sv, "narrow"sv, "numeric"sv, "2-digit"sv };
|
static constexpr AK::Array<StringView, 5> time_values = { "long"sv, "short"sv, "narrow"sv, "numeric"sv, "2-digit"sv };
|
||||||
static constexpr AK::Array<StringView, 4> sub_second_values = { "long"sv, "short"sv, "narrow"sv, "numeric"sv };
|
static constexpr AK::Array<StringView, 4> sub_second_values = { "long"sv, "short"sv, "narrow"sv, "numeric"sv };
|
||||||
static constexpr AK::Array<DurationInstanceComponent, 10> duration_instances_components {
|
static constexpr AK::Array<DurationInstanceComponent, 10> duration_instances_components {
|
||||||
DurationInstanceComponent { &Temporal::DurationRecord::years, &DurationFormat::years_style, &DurationFormat::set_years_style, &DurationFormat::years_display, &DurationFormat::set_years_display, "years"sv, "year"sv, date_values, "narrow"sv },
|
DurationInstanceComponent { &Temporal::DurationRecord::years, &DurationFormat::years_style, &DurationFormat::set_years_style, &DurationFormat::years_display, &DurationFormat::set_years_display, "years"sv, "year"sv, date_values, "short"sv },
|
||||||
DurationInstanceComponent { &Temporal::DurationRecord::months, &DurationFormat::months_style, &DurationFormat::set_months_style, &DurationFormat::months_display, &DurationFormat::set_months_display, "months"sv, "month"sv, date_values, "narrow"sv },
|
DurationInstanceComponent { &Temporal::DurationRecord::months, &DurationFormat::months_style, &DurationFormat::set_months_style, &DurationFormat::months_display, &DurationFormat::set_months_display, "months"sv, "month"sv, date_values, "short"sv },
|
||||||
DurationInstanceComponent { &Temporal::DurationRecord::weeks, &DurationFormat::weeks_style, &DurationFormat::set_weeks_style, &DurationFormat::weeks_display, &DurationFormat::set_weeks_display, "weeks"sv, "week"sv, date_values, "narrow"sv },
|
DurationInstanceComponent { &Temporal::DurationRecord::weeks, &DurationFormat::weeks_style, &DurationFormat::set_weeks_style, &DurationFormat::weeks_display, &DurationFormat::set_weeks_display, "weeks"sv, "week"sv, date_values, "short"sv },
|
||||||
DurationInstanceComponent { &Temporal::DurationRecord::days, &DurationFormat::days_style, &DurationFormat::set_days_style, &DurationFormat::days_display, &DurationFormat::set_days_display, "days"sv, "day"sv, date_values, "narrow"sv },
|
DurationInstanceComponent { &Temporal::DurationRecord::days, &DurationFormat::days_style, &DurationFormat::set_days_style, &DurationFormat::days_display, &DurationFormat::set_days_display, "days"sv, "day"sv, date_values, "short"sv },
|
||||||
DurationInstanceComponent { &Temporal::DurationRecord::hours, &DurationFormat::hours_style, &DurationFormat::set_hours_style, &DurationFormat::hours_display, &DurationFormat::set_hours_display, "hours"sv, "hour"sv, time_values, "numeric"sv },
|
DurationInstanceComponent { &Temporal::DurationRecord::hours, &DurationFormat::hours_style, &DurationFormat::set_hours_style, &DurationFormat::hours_display, &DurationFormat::set_hours_display, "hours"sv, "hour"sv, time_values, "numeric"sv },
|
||||||
DurationInstanceComponent { &Temporal::DurationRecord::minutes, &DurationFormat::minutes_style, &DurationFormat::set_minutes_style, &DurationFormat::minutes_display, &DurationFormat::set_minutes_display, "minutes"sv, "minute"sv, time_values, "numeric"sv },
|
DurationInstanceComponent { &Temporal::DurationRecord::minutes, &DurationFormat::minutes_style, &DurationFormat::set_minutes_style, &DurationFormat::minutes_display, &DurationFormat::set_minutes_display, "minutes"sv, "minute"sv, time_values, "numeric"sv },
|
||||||
DurationInstanceComponent { &Temporal::DurationRecord::seconds, &DurationFormat::seconds_style, &DurationFormat::set_seconds_style, &DurationFormat::seconds_display, &DurationFormat::set_seconds_display, "seconds"sv, "second"sv, time_values, "numeric"sv },
|
DurationInstanceComponent { &Temporal::DurationRecord::seconds, &DurationFormat::seconds_style, &DurationFormat::set_seconds_style, &DurationFormat::seconds_display, &DurationFormat::set_seconds_display, "seconds"sv, "second"sv, time_values, "numeric"sv },
|
||||||
|
|
|
@ -32,7 +32,7 @@ describe("correct behavior", () => {
|
||||||
"1y 2m 3w 3d 4h 5m 6s 7ms 8μs 9ns"
|
"1y 2m 3w 3d 4h 5m 6s 7ms 8μs 9ns"
|
||||||
);
|
);
|
||||||
expect(new Intl.DurationFormat("en", { style: "digital" }).format(duration)).toBe(
|
expect(new Intl.DurationFormat("en", { style: "digital" }).format(duration)).toBe(
|
||||||
"1y 2m 3w 3d 4:05:06"
|
"1 yr 2 mths 3 wks 3 days 4:05:06"
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
new Intl.DurationFormat("en", {
|
new Intl.DurationFormat("en", {
|
||||||
|
@ -52,7 +52,7 @@ describe("correct behavior", () => {
|
||||||
"1 J, 2 M, 3 W, 3 T, 4 Std., 5 Min., 6 Sek., 7 ms, 8 μs und 9 ns"
|
"1 J, 2 M, 3 W, 3 T, 4 Std., 5 Min., 6 Sek., 7 ms, 8 μs und 9 ns"
|
||||||
);
|
);
|
||||||
expect(new Intl.DurationFormat("de", { style: "digital" }).format(duration)).toBe(
|
expect(new Intl.DurationFormat("de", { style: "digital" }).format(duration)).toBe(
|
||||||
"1 J, 2 M, 3 W, 3 T und 4:05:06"
|
"1 J, 2 Mon., 3 Wo., 3 Tg. und 4:05:06"
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
new Intl.DurationFormat("de", {
|
new Intl.DurationFormat("de", {
|
||||||
|
|
|
@ -123,13 +123,13 @@ describe("correct behavior", () => {
|
||||||
]);
|
]);
|
||||||
expect(new Intl.DurationFormat("en", { style: "digital" }).formatToParts(duration)).toEqual(
|
expect(new Intl.DurationFormat("en", { style: "digital" }).formatToParts(duration)).toEqual(
|
||||||
[
|
[
|
||||||
{ type: "element", value: "1y" },
|
{ type: "element", value: "1 yr" },
|
||||||
{ type: "literal", value: " " },
|
{ type: "literal", value: " " },
|
||||||
{ type: "element", value: "2m" },
|
{ type: "element", value: "2 mths" },
|
||||||
{ type: "literal", value: " " },
|
{ type: "literal", value: " " },
|
||||||
{ type: "element", value: "3w" },
|
{ type: "element", value: "3 wks" },
|
||||||
{ type: "literal", value: " " },
|
{ type: "literal", value: " " },
|
||||||
{ type: "element", value: "3d" },
|
{ type: "element", value: "3 days" },
|
||||||
{ type: "literal", value: " " },
|
{ type: "literal", value: " " },
|
||||||
{ type: "element", value: "4:05:06" },
|
{ type: "element", value: "4:05:06" },
|
||||||
]
|
]
|
||||||
|
@ -227,11 +227,11 @@ describe("correct behavior", () => {
|
||||||
[
|
[
|
||||||
{ type: "element", value: "1 J" },
|
{ type: "element", value: "1 J" },
|
||||||
{ type: "literal", value: ", " },
|
{ type: "literal", value: ", " },
|
||||||
{ type: "element", value: "2 M" },
|
{ type: "element", value: "2 Mon." },
|
||||||
{ type: "literal", value: ", " },
|
{ type: "literal", value: ", " },
|
||||||
{ type: "element", value: "3 W" },
|
{ type: "element", value: "3 Wo." },
|
||||||
{ type: "literal", value: ", " },
|
{ type: "literal", value: ", " },
|
||||||
{ type: "element", value: "3 T" },
|
{ type: "element", value: "3 Tg." },
|
||||||
{ type: "literal", value: " und " },
|
{ type: "literal", value: " und " },
|
||||||
{ type: "element", value: "4:05:06" },
|
{ type: "element", value: "4:05:06" },
|
||||||
]
|
]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue