Bug 1806042 - Update tests to expect normal spaces rather than U+202F/2009 in formatted date/time strings. r=gregtatum

We'll need to revert this when we're ready to disable the workaround.

Depends on D165408

Differential Revision: https://phabricator.services.mozilla.com/D165409
This commit is contained in:
Jonathan Kew 2022-12-24 10:35:10 +00:00
Родитель 34a08b7422
Коммит 859eb99179
16 изменённых файлов: 254 добавлений и 255 удалений

Просмотреть файл

@ -332,15 +332,15 @@ const TEST_DATA = [
{ queryString: "0 utc in utc", expected: "00:00 UTC" },
{ queryString: "0 utc = utc", expected: "00:00 UTC" },
{ queryString: "0 UTC=UTC", expected: "00:00 UTC" },
{ queryString: "11 pm utc to utc", expected: "11:00\u{202F}PM UTC" },
{ queryString: "11 am utc to utc", expected: "11:00\u{202F}AM UTC" },
{ queryString: "11 pm utc to utc", expected: "11:00 PM UTC" },
{ queryString: "11 am utc to utc", expected: "11:00 AM UTC" },
{ queryString: "11:30 utc to utc", expected: "11:30 UTC" },
{ queryString: "11:30 PM utc to utc", expected: "11:30\u{202F}PM UTC" },
{ queryString: "11:30 PM utc to utc", expected: "11:30 PM UTC" },
{ queryString: "1 utc to idlw", expected: "13:00 IDLW" },
{ queryString: "1 pm utc to idlw", expected: "1:00\u{202F}AM IDLW" },
{ queryString: "1 am utc to idlw", expected: "1:00\u{202F}PM IDLW" },
{ queryString: "1 pm utc to idlw", expected: "1:00 AM IDLW" },
{ queryString: "1 am utc to idlw", expected: "1:00 PM IDLW" },
{ queryString: "1 utc to idlw", expected: "13:00 IDLW" },
{ queryString: "1 PM utc to idlw", expected: "1:00\u{202F}AM IDLW" },
{ queryString: "1 PM utc to idlw", expected: "1:00 AM IDLW" },
{ queryString: "0 utc to nt", expected: "13:00 NT" },
{ queryString: "0 utc to hst", expected: "14:00 HST" },
{ queryString: "0 utc to akst", expected: "15:00 AKST" },
@ -385,14 +385,14 @@ const TEST_DATA = [
{ queryString: "0 utc to nzd", expected: "13:00 NZD" },
{ queryString: "9:00 jst to utc", expected: "00:00 UTC" },
{ queryString: "8:00 jst to utc", expected: "23:00 UTC" },
{ queryString: "8:00 am jst to utc", expected: "11:00\u{202F}PM UTC" },
{ queryString: "8:00 am jst to utc", expected: "11:00 PM UTC" },
{ queryString: "9:00 jst to pdt", expected: "17:00 PDT" },
{ queryString: "12 pm pst to cet", expected: "9:00\u{202F}PM CET" },
{ queryString: "12 am pst to cet", expected: "9:00\u{202F}AM CET" },
{ queryString: "12:30 pm pst to cet", expected: "9:30\u{202F}PM CET" },
{ queryString: "12:30 am pst to cet", expected: "9:30\u{202F}AM CET" },
{ queryString: "23 pm pst to cet", expected: "8:00\u{202F}AM CET" },
{ queryString: "23:30 pm pst to cet", expected: "8:30\u{202F}AM CET" },
{ queryString: "12 pm pst to cet", expected: "9:00 PM CET" },
{ queryString: "12 am pst to cet", expected: "9:00 AM CET" },
{ queryString: "12:30 pm pst to cet", expected: "9:30 PM CET" },
{ queryString: "12:30 am pst to cet", expected: "9:30 AM CET" },
{ queryString: "23 pm pst to cet", expected: "8:00 AM CET" },
{ queryString: "23:30 pm pst to cet", expected: "8:30 AM CET" },
{
queryString: "10:00 JST to here",
timezone: "UTC",
@ -406,7 +406,7 @@ const TEST_DATA = [
{
queryString: "1 am to JST",
timezone: "UTC",
expected: "10:00\u{202F}AM JST",
expected: "10:00 AM JST",
},
{
queryString: "now to JST",

Просмотреть файл

@ -47,7 +47,7 @@ TEST(IntlDateIntervalFormat, TryFormatDateTime)
spanResult = formatted.ToSpan();
ASSERT_TRUE(spanResult.isOk());
ASSERT_EQ(spanResult.unwrap(),
MakeStringSpan(u"01/03, 00:00\u2009\u200901/05, 00:00"));
MakeStringSpan(u"01/03, 00:0001/05, 00:00"));
}
TEST(IntlDateIntervalFormat, TryFormatCalendar)
@ -104,7 +104,7 @@ TEST(IntlDateIntervalFormat, TryFormatCalendar)
spanResult = formatted.ToSpan();
ASSERT_TRUE(spanResult.isOk());
ASSERT_EQ(spanResult.unwrap(),
MakeStringSpan(u"01/03, 00:00\u2009\u200901/05, 00:00"));
MakeStringSpan(u"01/03, 00:0001/05, 00:00"));
}
TEST(IntlDateIntervalFormat, TryFormattedToParts)
@ -123,8 +123,7 @@ TEST(IntlDateIntervalFormat, TryFormattedToParts)
ASSERT_FALSE(equal);
Span<const char16_t> formattedSpan = formatted.ToSpan().unwrap();
ASSERT_EQ(formattedSpan,
MakeStringSpan(u"01/03, 00:00\u2009\u200901/05, 00:00"));
ASSERT_EQ(formattedSpan, MakeStringSpan(u"01/03, 00:00 – 01/05, 00:00"));
mozilla::intl::DateTimePartVector parts;
result = dif->TryFormattedToParts(formatted, parts);
@ -165,7 +164,7 @@ TEST(IntlDateIntervalFormat, TryFormattedToParts)
ASSERT_EQ(parts[6].mSource, DateTimePartSource::StartRange);
ASSERT_EQ(parts[7].mType, DateTimePartType::Literal);
ASSERT_EQ(getSubSpan(7), MakeStringSpan(u"\u2009\u2009"));
ASSERT_EQ(getSubSpan(7), MakeStringSpan(u""));
ASSERT_EQ(parts[7].mSource, DateTimePartSource::Shared);
ASSERT_EQ(parts[8].mType, DateTimePartType::Month);

Просмотреть файл

@ -38,7 +38,7 @@ TEST(IntlDateTimeFormat, Style_enUS_utf8)
TestBuffer<char> buffer;
dtFormat->TryFormat(DATE, buffer).unwrap();
ASSERT_TRUE(buffer.verboseMatches("Sep 23, 2002, 8:07:30\u202FPM"));
ASSERT_TRUE(buffer.verboseMatches("Sep 23, 2002, 8:07:30 PM"));
}
TEST(IntlDateTimeFormat, Style_enUS_utf16)
@ -51,7 +51,7 @@ TEST(IntlDateTimeFormat, Style_enUS_utf16)
TestBuffer<char16_t> buffer;
dtFormat->TryFormat(DATE, buffer).unwrap();
ASSERT_TRUE(buffer.verboseMatches(u"Sep 23, 2002, 8:07:30\u202FPM"));
ASSERT_TRUE(buffer.verboseMatches(u"Sep 23, 2002, 8:07:30 PM"));
}
TEST(IntlDateTimeFormat, Style_ar_utf8)
@ -86,7 +86,7 @@ TEST(IntlDateTimeFormat, Style_enUS_fallback_to_default_styles)
TestBuffer<char> buffer;
dtFormat->TryFormat(DATE, buffer).unwrap();
ASSERT_TRUE(buffer.verboseMatches("Sep 23, 2002, 8:07:30\u202FPM"));
ASSERT_TRUE(buffer.verboseMatches("Sep 23, 2002, 8:07:30 PM"));
}
TEST(IntlDateTimeFormat, Time_zone_IANA_identifier)
@ -103,7 +103,7 @@ TEST(IntlDateTimeFormat, Time_zone_IANA_identifier)
.unwrap();
TestBuffer<char> buffer;
dtFormat->TryFormat(DATE, buffer).unwrap();
ASSERT_TRUE(buffer.verboseMatches("Sep 23, 2002, 12:07:30\u202FPM"));
ASSERT_TRUE(buffer.verboseMatches("Sep 23, 2002, 12:07:30 PM"));
}
TEST(IntlDateTimeFormat, GetAllowedHourCycles)
@ -191,7 +191,7 @@ TEST(IntlDateTimeFormat, Components)
TestBuffer<char16_t> buffer;
ASSERT_TRUE(FormatComponents(buffer, components));
ASSERT_TRUE(buffer.verboseMatches(u"9/23/2002, 8:07:30\u202FPM"));
ASSERT_TRUE(buffer.verboseMatches(u"9/23/2002, 8:07:30 PM"));
}
TEST(IntlDateTimeFormat, Components_es_ES)
@ -246,7 +246,7 @@ TEST(IntlDateTimeFormat, ComponentsHour12Default)
TestBuffer<char16_t> buffer;
ASSERT_TRUE(FormatComponents(buffer, components));
ASSERT_TRUE(buffer.verboseMatches(u"8:07\u202FPM"));
ASSERT_TRUE(buffer.verboseMatches(u"8:07 PM"));
}
TEST(IntlDateTimeFormat, ComponentsHour24)

Просмотреть файл

@ -48,7 +48,7 @@ dt-style = Style formatting: { DATETIME($dateArg, dateStyle: "short", timeStyle:
testMessage(
"dt-bare",
FIREFOX_RELEASE_TIMESTAMP,
/^The bare date is: Sep \d+, 2002, \d+:\d+:\d+\u202f(AM|PM)$/
/^The bare date is: Sep \d+, 2002, \d+:\d+:\d+ (AM|PM)$/
);
testMessage(
"dt-month-year",
@ -58,17 +58,17 @@ dt-style = Style formatting: { DATETIME($dateArg, dateStyle: "short", timeStyle:
testMessage(
"dt-bad",
FIREFOX_RELEASE_TIMESTAMP,
/^This is a bad month: Sep \d+, 2002, \d+:\d+:\d+\u202f(AM|PM)$/
/^This is a bad month: Sep \d+, 2002, \d+:\d+:\d+ (AM|PM)$/
);
testMessage(
"dt-unknown",
FIREFOX_RELEASE_TIMESTAMP,
/^Unknown: Sep \d+, 2002, \d+:\d+:\d+\u202f(AM|PM)$/
/^Unknown: Sep \d+, 2002, \d+:\d+:\d+ (AM|PM)$/
);
testMessage(
"dt-style",
FIREFOX_RELEASE_TIMESTAMP,
/^Style formatting: \d+\/\d+\/\d+, \d+:\d+\u202f(AM|PM)$/
/^Style formatting: \d+\/\d+\/\d+, \d+:\d+ (AM|PM)$/
);
// TODO - Bug 1707728

Просмотреть файл

@ -5,13 +5,13 @@ const testCases = [
timeZone: "Europe/London",
string: "Tue Aug 14 2018 00:00:00 GMT+0100 (BST)",
alternativeTimeZones: ["British Summer Time"],
localeString: "8/14/2018, 12:00:00\u202FAM GMT+1",
localeString: "8/14/2018, 12:00:00 AM GMT+1",
},
{
timeZone: "UTC",
string: "Tue Aug 14 2018 00:00:00 GMT+0000 (UTC)",
alternativeTimeZones: ["Coordinated Universal Time"],
localeString: "8/14/2018, 12:00:00\u202FAM UTC",
localeString: "8/14/2018, 12:00:00 AM UTC",
},
];

Просмотреть файл

@ -379,21 +379,21 @@ inTimeZone("Europe/Moscow", () => {
assertDateTime(dt, "Mon May 14 2012 12:13:14 GMT+0400 (Moscow Standard Time)");
let dtf = new Intl.DateTimeFormat("en-US", {hour: "numeric", minute: "numeric"});
assertEq(dtf.format(dt), "12:13\u202FPM");
assertEq(dtf.format(dt), "12:13 PM");
});
inTimeZone("Asia/Baku", () => {
let dt = new Date(2012, Month.May, 14, 12, 13, 14);
assertDateTime(dt, "Mon May 14 2012 12:13:14 GMT+0500 (Azerbaijan Summer Time)");
let dtf = new Intl.DateTimeFormat("en-US", {hour: "numeric", minute: "numeric"});
assertEq(dtf.format(dt), "12:13\u202FPM");
assertEq(dtf.format(dt), "12:13 PM");
});
inTimeZone("Asia/Tbilisi", () => {
let dt = new Date(2012, Month.May, 14, 12, 13, 14);
assertDateTime(dt, "Mon May 14 2012 12:13:14 GMT+0400 (Georgia Standard Time)");
let dtf = new Intl.DateTimeFormat("en-US", {hour: "numeric", minute: "numeric"});
assertEq(dtf.format(dt), "12:13\u202FPM");
assertEq(dtf.format(dt), "12:13 PM");
});
// bug 1335818

Просмотреть файл

@ -497,9 +497,9 @@ inTimeZone("America/Caracas", () => {
TimeString: "00:00:00 GMT-0400 (Venezuela Time)",
UTCString: "Wed, 05 Dec 2007 04:00:00 GMT",
ISOString: "2007-12-05T04:00:00.000Z",
LocaleString: "Wed, 12/05/2007, 12:00:00\u202FAM GMT-4",
LocaleString: "Wed, 12/05/2007, 12:00:00 AM GMT-4",
LocaleDateString: "Wed, 12/05/2007",
LocaleTimeString: "12:00:00\u202FAM GMT-4",
LocaleTimeString: "12:00:00 AM GMT-4",
});
}
@ -514,9 +514,9 @@ inTimeZone("America/Caracas", () => {
TimeString: "00:00:00 GMT-0430 (Venezuela Time)",
UTCString: "Wed, 12 Dec 2007 04:30:00 GMT",
ISOString: "2007-12-12T04:30:00.000Z",
LocaleString: "Wed, 12/12/2007, 12:00:00\u202FAM GMT-4:30",
LocaleString: "Wed, 12/12/2007, 12:00:00 AM GMT-4:30",
LocaleDateString: "Wed, 12/12/2007",
LocaleTimeString: "12:00:00\u202FAM GMT-4:30",
LocaleTimeString: "12:00:00 AM GMT-4:30",
});
}
});
@ -537,9 +537,9 @@ inTimeZone("Australia/Lord_Howe", () => {
TimeString: "00:00:00 GMT+1030 (Lord Howe Standard Time)",
UTCString: "Sat, 31 Jul 2010 13:30:00 GMT",
ISOString: "2010-07-31T13:30:00.000Z",
LocaleString: "Sun, 08/01/2010, 12:00:00\u202FAM GMT+10:30",
LocaleString: "Sun, 08/01/2010, 12:00:00 AM GMT+10:30",
LocaleDateString: "Sun, 08/01/2010",
LocaleTimeString: "12:00:00\u202FAM GMT+10:30",
LocaleTimeString: "12:00:00 AM GMT+10:30",
});
}
@ -554,9 +554,9 @@ inTimeZone("Australia/Lord_Howe", () => {
TimeString: "00:00:00 GMT+1100 (Lord Howe Daylight Time)",
UTCString: "Sat, 02 Jan 2010 13:00:00 GMT",
ISOString: "2010-01-02T13:00:00.000Z",
LocaleString: "Sun, 01/03/2010, 12:00:00\u202FAM GMT+11",
LocaleString: "Sun, 01/03/2010, 12:00:00 AM GMT+11",
LocaleDateString: "Sun, 01/03/2010",
LocaleTimeString: "12:00:00\u202FAM GMT+11",
LocaleTimeString: "12:00:00 AM GMT+11",
});
}
});
@ -630,9 +630,9 @@ inTimeZone("Europe/London", () => {
TimeString: "00:00:00 GMT+0100 (Greenwich Mean Time)",
UTCString: "Wed, 31 Dec 1969 23:00:00 GMT",
ISOString: "1969-12-31T23:00:00.000Z",
LocaleString: "Thu, 01/01/1970, 12:00:00\u202FAM GMT+1",
LocaleString: "Thu, 01/01/1970, 12:00:00 AM GMT+1",
LocaleDateString: "Thu, 01/01/1970",
LocaleTimeString: "12:00:00\u202FAM GMT+1",
LocaleTimeString: "12:00:00 AM GMT+1",
});
}
});
@ -651,9 +651,9 @@ inTimeZone("Europe/Moscow", () => {
TimeString: "00:00:00 GMT+0300 (Moscow Standard Time)",
UTCString: "Wed, 31 Dec 1969 21:00:00 GMT",
ISOString: "1969-12-31T21:00:00.000Z",
LocaleString: "Thu, 01/01/1970, 12:00:00\u202FAM GMT+3",
LocaleString: "Thu, 01/01/1970, 12:00:00 AM GMT+3",
LocaleDateString: "Thu, 01/01/1970",
LocaleTimeString: "12:00:00\u202FAM GMT+3",
LocaleTimeString: "12:00:00 AM GMT+3",
});
}
@ -671,9 +671,9 @@ inTimeZone("Europe/Moscow", () => {
TimeString: "00:00:00 GMT+0400 (Moscow Summer Time)",
UTCString: "Fri, 31 Aug 1990 20:00:00 GMT",
ISOString: "1990-08-31T20:00:00.000Z",
LocaleString: "Sat, 09/01/1990, 12:00:00\u202FAM GMT+4",
LocaleString: "Sat, 09/01/1990, 12:00:00 AM GMT+4",
LocaleDateString: "Sat, 09/01/1990",
LocaleTimeString: "12:00:00\u202FAM GMT+4",
LocaleTimeString: "12:00:00 AM GMT+4",
});
}
@ -688,9 +688,9 @@ inTimeZone("Europe/Moscow", () => {
TimeString: "00:00:00 GMT+0300 (Moscow Standard Time)",
UTCString: "Sun, 24 Mar 1991 21:00:00 GMT",
ISOString: "1991-03-24T21:00:00.000Z",
LocaleString: "Mon, 03/25/1991, 12:00:00\u202FAM GMT+3",
LocaleString: "Mon, 03/25/1991, 12:00:00 AM GMT+3",
LocaleDateString: "Mon, 03/25/1991",
LocaleTimeString: "12:00:00\u202FAM GMT+3",
LocaleTimeString: "12:00:00 AM GMT+3",
});
}
@ -705,9 +705,9 @@ inTimeZone("Europe/Moscow", () => {
TimeString: "12:00:00 GMT+0300 (Moscow Summer Time)",
UTCString: "Sun, 31 Mar 1991 09:00:00 GMT",
ISOString: "1991-03-31T09:00:00.000Z",
LocaleString: "Sun, 03/31/1991, 12:00:00\u202FPM GMT+3",
LocaleString: "Sun, 03/31/1991, 12:00:00 PM GMT+3",
LocaleDateString: "Sun, 03/31/1991",
LocaleTimeString: "12:00:00\u202FPM GMT+3",
LocaleTimeString: "12:00:00 PM GMT+3",
});
}
@ -722,9 +722,9 @@ inTimeZone("Europe/Moscow", () => {
TimeString: "00:00:00 GMT+0300 (Moscow Summer Time)",
UTCString: "Fri, 27 Sep 1991 21:00:00 GMT",
ISOString: "1991-09-27T21:00:00.000Z",
LocaleString: "Sat, 09/28/1991, 12:00:00\u202FAM GMT+3",
LocaleString: "Sat, 09/28/1991, 12:00:00 AM GMT+3",
LocaleDateString: "Sat, 09/28/1991",
LocaleTimeString: "12:00:00\u202FAM GMT+3",
LocaleTimeString: "12:00:00 AM GMT+3",
});
}
@ -739,9 +739,9 @@ inTimeZone("Europe/Moscow", () => {
TimeString: "00:00:00 GMT+0200 (Moscow Standard Time)",
UTCString: "Sun, 29 Sep 1991 22:00:00 GMT",
ISOString: "1991-09-29T22:00:00.000Z",
LocaleString: "Mon, 09/30/1991, 12:00:00\u202FAM GMT+2",
LocaleString: "Mon, 09/30/1991, 12:00:00 AM GMT+2",
LocaleDateString: "Mon, 09/30/1991",
LocaleTimeString: "12:00:00\u202FAM GMT+2",
LocaleTimeString: "12:00:00 AM GMT+2",
});
}
@ -759,9 +759,9 @@ inTimeZone("Europe/Moscow", () => {
TimeString: "00:00:00 GMT+0400 (Moscow Summer Time)",
UTCString: "Fri, 29 Oct 2010 20:00:00 GMT",
ISOString: "2010-10-29T20:00:00.000Z",
LocaleString: "Sat, 10/30/2010, 12:00:00\u202FAM GMT+4",
LocaleString: "Sat, 10/30/2010, 12:00:00 AM GMT+4",
LocaleDateString: "Sat, 10/30/2010",
LocaleTimeString: "12:00:00\u202FAM GMT+4",
LocaleTimeString: "12:00:00 AM GMT+4",
});
}
@ -776,9 +776,9 @@ inTimeZone("Europe/Moscow", () => {
TimeString: "00:00:00 GMT+0300 (Moscow Standard Time)",
UTCString: "Sun, 31 Oct 2010 21:00:00 GMT",
ISOString: "2010-10-31T21:00:00.000Z",
LocaleString: "Mon, 11/01/2010, 12:00:00\u202FAM GMT+3",
LocaleString: "Mon, 11/01/2010, 12:00:00 AM GMT+3",
LocaleDateString: "Mon, 11/01/2010",
LocaleTimeString: "12:00:00\u202FAM GMT+3",
LocaleTimeString: "12:00:00 AM GMT+3",
});
}
@ -793,9 +793,9 @@ inTimeZone("Europe/Moscow", () => {
TimeString: "00:00:00 GMT+0400 (Moscow Standard Time)",
UTCString: "Sat, 29 Oct 2011 20:00:00 GMT",
ISOString: "2011-10-29T20:00:00.000Z",
LocaleString: "Sun, 10/30/2011, 12:00:00\u202FAM GMT+4",
LocaleString: "Sun, 10/30/2011, 12:00:00 AM GMT+4",
LocaleDateString: "Sun, 10/30/2011",
LocaleTimeString: "12:00:00\u202FAM GMT+4",
LocaleTimeString: "12:00:00 AM GMT+4",
});
}
@ -810,9 +810,9 @@ inTimeZone("Europe/Moscow", () => {
TimeString: "00:00:00 GMT+0400 (Moscow Standard Time)",
UTCString: "Mon, 31 Oct 2011 20:00:00 GMT",
ISOString: "2011-10-31T20:00:00.000Z",
LocaleString: "Tue, 11/01/2011, 12:00:00\u202FAM GMT+4",
LocaleString: "Tue, 11/01/2011, 12:00:00 AM GMT+4",
LocaleDateString: "Tue, 11/01/2011",
LocaleTimeString: "12:00:00\u202FAM GMT+4",
LocaleTimeString: "12:00:00 AM GMT+4",
});
}
@ -829,9 +829,9 @@ inTimeZone("Europe/Moscow", () => {
TimeString: "00:00:00 GMT+0400 (Moscow Standard Time)",
UTCString: "Sat, 25 Oct 2014 20:00:00 GMT",
ISOString: "2014-10-25T20:00:00.000Z",
LocaleString: "Sun, 10/26/2014, 12:00:00\u202FAM GMT+4",
LocaleString: "Sun, 10/26/2014, 12:00:00 AM GMT+4",
LocaleDateString: "Sun, 10/26/2014",
LocaleTimeString: "12:00:00\u202FAM GMT+4",
LocaleTimeString: "12:00:00 AM GMT+4",
});
}
@ -846,9 +846,9 @@ inTimeZone("Europe/Moscow", () => {
TimeString: "00:00:00 GMT+0300 (Moscow Standard Time)",
UTCString: "Sun, 26 Oct 2014 21:00:00 GMT",
ISOString: "2014-10-26T21:00:00.000Z",
LocaleString: "Mon, 10/27/2014, 12:00:00\u202FAM GMT+3",
LocaleString: "Mon, 10/27/2014, 12:00:00 AM GMT+3",
LocaleDateString: "Mon, 10/27/2014",
LocaleTimeString: "12:00:00\u202FAM GMT+3",
LocaleTimeString: "12:00:00 AM GMT+3",
});
}
});
@ -869,9 +869,9 @@ inTimeZone("Pacific/Apia", () => {
TimeString: "00:00:00 GMT-1000 (Apia Daylight Time)",
UTCString: "Thu, 29 Dec 2011 10:00:00 GMT",
ISOString: "2011-12-29T10:00:00.000Z",
LocaleString: "Thu, 12/29/2011, 12:00:00\u202FAM GMT-10",
LocaleString: "Thu, 12/29/2011, 12:00:00 AM GMT-10",
LocaleDateString: "Thu, 12/29/2011",
LocaleTimeString: "12:00:00\u202FAM GMT-10",
LocaleTimeString: "12:00:00 AM GMT-10",
});
}
@ -886,9 +886,9 @@ inTimeZone("Pacific/Apia", () => {
TimeString: "00:00:00 GMT+1400 (Apia Daylight Time)",
UTCString: "Fri, 30 Dec 2011 10:00:00 GMT",
ISOString: "2011-12-30T10:00:00.000Z",
LocaleString: "Sat, 12/31/2011, 12:00:00\u202FAM GMT+14",
LocaleString: "Sat, 12/31/2011, 12:00:00 AM GMT+14",
LocaleDateString: "Sat, 12/31/2011",
LocaleTimeString: "12:00:00\u202FAM GMT+14",
LocaleTimeString: "12:00:00 AM GMT+14",
});
}
@ -903,9 +903,9 @@ inTimeZone("Pacific/Apia", () => {
TimeString: "00:00:00 GMT+1300 (Apia Standard Time)",
UTCString: "Sun, 01 Apr 2012 11:00:00 GMT",
ISOString: "2012-04-01T11:00:00.000Z",
LocaleString: "Mon, 04/02/2012, 12:00:00\u202FAM GMT+13",
LocaleString: "Mon, 04/02/2012, 12:00:00 AM GMT+13",
LocaleDateString: "Mon, 04/02/2012",
LocaleTimeString: "12:00:00\u202FAM GMT+13",
LocaleTimeString: "12:00:00 AM GMT+13",
});
}
});
@ -926,9 +926,9 @@ inTimeZone("Pacific/Chatham", () => {
TimeString: "00:00:00 GMT+1245 (Chatham Standard Time)",
UTCString: "Sat, 31 Jul 2010 11:15:00 GMT",
ISOString: "2010-07-31T11:15:00.000Z",
LocaleString: "Sun, 08/01/2010, 12:00:00\u202FAM GMT+12:45",
LocaleString: "Sun, 08/01/2010, 12:00:00 AM GMT+12:45",
LocaleDateString: "Sun, 08/01/2010",
LocaleTimeString: "12:00:00\u202FAM GMT+12:45",
LocaleTimeString: "12:00:00 AM GMT+12:45",
});
}
@ -943,9 +943,9 @@ inTimeZone("Pacific/Chatham", () => {
TimeString: "00:00:00 GMT+1345 (Chatham Daylight Time)",
UTCString: "Sat, 02 Jan 2010 10:15:00 GMT",
ISOString: "2010-01-02T10:15:00.000Z",
LocaleString: "Sun, 01/03/2010, 12:00:00\u202FAM GMT+13:45",
LocaleString: "Sun, 01/03/2010, 12:00:00 AM GMT+13:45",
LocaleDateString: "Sun, 01/03/2010",
LocaleTimeString: "12:00:00\u202FAM GMT+13:45",
LocaleTimeString: "12:00:00 AM GMT+13:45",
});
}
});
@ -966,9 +966,9 @@ inTimeZone("Pacific/Kiritimati", () => {
TimeString: "00:00:00 GMT+1400 (Line Islands Time)",
UTCString: "Sat, 31 Jul 2010 10:00:00 GMT",
ISOString: "2010-07-31T10:00:00.000Z",
LocaleString: "Sun, 08/01/2010, 12:00:00\u202FAM GMT+14",
LocaleString: "Sun, 08/01/2010, 12:00:00 AM GMT+14",
LocaleDateString: "Sun, 08/01/2010",
LocaleTimeString: "12:00:00\u202FAM GMT+14",
LocaleTimeString: "12:00:00 AM GMT+14",
});
}
@ -985,9 +985,9 @@ inTimeZone("Pacific/Kiritimati", () => {
TimeString: "00:00:00 GMT-1040 (Line Islands Time)",
UTCString: "Wed, 01 Jan 1975 10:40:00 GMT",
ISOString: "1975-01-01T10:40:00.000Z",
LocaleString: "Wed, 01/01/1975, 12:00:00\u202FAM GMT-10:40",
LocaleString: "Wed, 01/01/1975, 12:00:00 AM GMT-10:40",
LocaleDateString: "Wed, 01/01/1975",
LocaleTimeString: "12:00:00\u202FAM GMT-10:40",
LocaleTimeString: "12:00:00 AM GMT-10:40",
});
}
});
@ -1008,9 +1008,9 @@ inTimeZone("Pacific/Niue", () => {
TimeString: "00:00:00 GMT-1120 (Niue Time)",
UTCString: "Sun, 01 Jan 1956 11:20:00 GMT",
ISOString: "1956-01-01T11:20:00.000Z",
LocaleString: "Sun, 01/01/1956, 12:00:00\u202FAM GMT-11:20",
LocaleString: "Sun, 01/01/1956, 12:00:00 AM GMT-11:20",
LocaleDateString: "Sun, 01/01/1956",
LocaleTimeString: "12:00:00\u202FAM GMT-11:20",
LocaleTimeString: "12:00:00 AM GMT-11:20",
});
}
});

Просмотреть файл

@ -3,7 +3,7 @@ if (typeof Intl === "object") {
const date = new Date(Date.UTC(2012, 11, 12, 3, 0, 0));
assertEq([date].toLocaleString("en-us", {timeZone: "UTC"}), "12/12/2012, 3:00:00\u202FAM");
assertEq([date].toLocaleString("en-us", {timeZone: "UTC"}), "12/12/2012, 3:00:00 AM");
assertEq([date].toLocaleString(["de", "en"], {timeZone: "UTC"}), "12.12.2012, 03:00:00");
assertEq([date].toLocaleString("th-th", {timeZone: "UTC"}), "12/12/2555 03:00:00");
assertEq([date].toLocaleString("th-th-u-nu-thai", {timeZone: "UTC"}), "๑๒/๑๒/๒๕๕๕ ๐๓::");

Просмотреть файл

@ -7,11 +7,11 @@ const defaultOptions = {};
const tests = [
{
timeZone: "UTC",
result: "12/6/2012, 12:00:00\u202FPM",
result: "12/6/2012, 12:00:00 PM",
},
{
timeZone: "America/Los_Angeles",
result: "12/6/2012, 4:00:00\u202FAM",
result: "12/6/2012, 4:00:00 AM",
},
{
timeZone: "Europe/Berlin", locale: "de",
@ -30,7 +30,7 @@ const tests = [
},
{
timeZone: { toString: () => "Australia/Melbourne" }, locale: "en-AU",
result: "06/12/2012, 11:00:00\u202Fpm",
result: "06/12/2012, 11:00:00 pm",
},
];

Просмотреть файл

@ -7,11 +7,11 @@ const defaultOptions = {};
const tests = [
{
timeZone: "UTC",
result: "12:00:00\u202FPM",
result: "12:00:00 PM",
},
{
timeZone: "America/Los_Angeles",
result: "4:00:00\u202FAM",
result: "4:00:00 AM",
},
{
timeZone: "Europe/Berlin", locale: "de",
@ -30,7 +30,7 @@ const tests = [
},
{
timeZone: { toString: () => "Australia/Melbourne" }, locale: "en-AU",
result: "11:00:00\u202Fpm",
result: "11:00:00 pm",
},
];

Просмотреть файл

@ -9,7 +9,7 @@ const tests = [
hour: "numeric",
},
locales: {
"en": "3\u202FAM",
"en": "3 AM",
"de": "03 Uhr",
},
},
@ -18,7 +18,7 @@ const tests = [
hour: "2-digit",
},
locales: {
"en": "03\u202FAM",
"en": "03 AM",
"de": "03 Uhr",
},
},
@ -70,7 +70,7 @@ const tests = [
minute: "numeric",
},
locales: {
"en": "3:04\u202FAM",
"en": "3:04 AM",
"de": "03:04",
},
},
@ -80,7 +80,7 @@ const tests = [
minute: "2-digit",
},
locales: {
"en": "3:04\u202FAM",
"en": "3:04 AM",
"de": "03:04",
},
},
@ -90,7 +90,7 @@ const tests = [
minute: "numeric",
},
locales: {
"en": "03:04\u202FAM",
"en": "03:04 AM",
"de": "03:04",
},
},
@ -100,7 +100,7 @@ const tests = [
minute: "2-digit",
},
locales: {
"en": "03:04\u202FAM",
"en": "03:04 AM",
"de": "03:04",
},
},
@ -155,8 +155,8 @@ const tests = [
hourCycle: "h12",
},
locales: {
"en": "3:04\u202FAM",
"de": "3:04\u202FAM",
"en": "3:04 AM",
"de": "3:04 AM",
},
},
{
@ -166,8 +166,8 @@ const tests = [
hourCycle: "h12",
},
locales: {
"en": "03:04\u202FAM",
"de": "03:04\u202FAM",
"en": "03:04 AM",
"de": "03:04 AM",
},
},
@ -204,7 +204,7 @@ for (let {options, locales} of tests) {
}
const toLocaleTests = {
"en": "1/2/2021, 3:04:05\u202FAM",
"en": "1/2/2021, 3:04:05 AM",
"de": "2.1.2021, 03:04:05",
};
@ -213,7 +213,7 @@ for (let [locale, expected] of Object.entries(toLocaleTests)) {
}
const toLocaleTimeTests = {
"en": "3:04:05\u202FAM",
"en": "3:04:05 AM",
"de": "03:04:05",
};

Просмотреть файл

@ -18,11 +18,11 @@ let tests = {
start: 0,
end: 10,
data: [
"12\u2009–\u200910\u202FAM",
"0\u2009–\u200910\u202FAM",
"12\u2009–\u200910\u202FAM",
"00\u2009–\u200910",
"24\u2009–\u200910",
"12 – 10 AM",
"0 – 10 AM",
"12 – 10 AM",
"0010",
"2410",
],
},
// Midnight to noon.
@ -30,11 +30,11 @@ let tests = {
start: 0,
end: 12,
data: [
"12\u202FAM\u2009–\u200912\u202FPM",
"0\u202FAM\u2009–\u20090\u202FPM",
"12\u202FAM\u2009–\u200912\u202FPM",
"00\u2009–\u200912",
"24\u2009–\u200912",
"12 AM – 12 PM",
"0 AM – 0 PM",
"12 AM – 12 PM",
"0012",
"2412",
],
},
// Midnight to evening.
@ -42,11 +42,11 @@ let tests = {
start: 0,
end: 22,
data: [
"12\u202FAM\u2009–\u200910\u202FPM",
"0\u202FAM\u2009–\u200910\u202FPM",
"12\u202FAM\u2009–\u200910\u202FPM",
"00\u2009–\u200922",
"24\u2009–\u200922",
"12 AM – 10 PM",
"0 AM – 10 PM",
"12 AM – 10 PM",
"0022",
"2422",
],
},
// Midnight to midnight.
@ -54,11 +54,11 @@ let tests = {
start: 0,
end: 24,
data: [
"1/1/1970, 12\u202FAM\u2009–\u20091/2/1970, 12\u202FAM",
"1/1/1970, 0\u202FAM\u2009–\u20091/2/1970, 0\u202FAM",
"1/1/1970, 12\u202FAM\u2009–\u20091/2/1970, 12\u202FAM",
"1/1/1970, 00\u2009–\u20091/2/1970, 00",
"1/1/1970, 24\u2009–\u20091/2/1970, 24",
"1/1/1970, 12 AM – 1/2/1970, 12 AM",
"1/1/1970, 0 AM – 1/2/1970, 0 AM",
"1/1/1970, 12 AM – 1/2/1970, 12 AM",
"1/1/1970, 001/2/1970, 00",
"1/1/1970, 241/2/1970, 24",
],
},
@ -67,11 +67,11 @@ let tests = {
start: 1,
end: 10,
data: [
"1\u2009–\u200910\u202FAM",
"1\u2009–\u200910\u202FAM",
"1\u2009–\u200910\u202FAM",
"01\u2009–\u200910",
"01\u2009–\u200910",
"1 – 10 AM",
"1 – 10 AM",
"1 – 10 AM",
"0110",
"0110",
],
},
// Morning to noon.
@ -79,11 +79,11 @@ let tests = {
start: 1,
end: 12,
data: [
"1\u202FAM\u2009–\u200912\u202FPM",
"1\u202FAM\u2009–\u20090\u202FPM",
"1\u202FAM\u2009–\u200912\u202FPM",
"01\u2009–\u200912",
"01\u2009–\u200912",
"1 AM – 12 PM",
"1 AM – 0 PM",
"1 AM – 12 PM",
"0112",
"0112",
],
},
// Morning to evening.
@ -91,11 +91,11 @@ let tests = {
start: 1,
end: 22,
data: [
"1\u202FAM\u2009–\u200910\u202FPM",
"1\u202FAM\u2009–\u200910\u202FPM",
"1\u202FAM\u2009–\u200910\u202FPM",
"01\u2009–\u200922",
"01\u2009–\u200922",
"1 AM – 10 PM",
"1 AM – 10 PM",
"1 AM – 10 PM",
"0122",
"0122",
],
},
// Morning to midnight.
@ -103,11 +103,11 @@ let tests = {
start: 1,
end: 24,
data: [
"1/1/1970, 1\u202FAM\u2009–\u20091/2/1970, 12\u202FAM",
"1/1/1970, 1\u202FAM\u2009–\u20091/2/1970, 0\u202FAM",
"1/1/1970, 1\u202FAM\u2009–\u20091/2/1970, 12\u202FAM",
"1/1/1970, 01\u2009–\u20091/2/1970, 00",
"1/1/1970, 01\u2009–\u20091/2/1970, 24",
"1/1/1970, 1 AM – 1/2/1970, 12 AM",
"1/1/1970, 1 AM – 1/2/1970, 0 AM",
"1/1/1970, 1 AM – 1/2/1970, 12 AM",
"1/1/1970, 011/2/1970, 00",
"1/1/1970, 011/2/1970, 24",
],
},
@ -116,11 +116,11 @@ let tests = {
start: 12,
end: 24 + 1,
data: [
"1/1/1970, 12\u202FPM\u2009–\u20091/2/1970, 1\u202FAM",
"1/1/1970, 0\u202FPM\u2009–\u20091/2/1970, 1\u202FAM",
"1/1/1970, 12\u202FPM\u2009–\u20091/2/1970, 1\u202FAM",
"1/1/1970, 12\u2009–\u20091/2/1970, 01",
"1/1/1970, 12\u2009–\u20091/2/1970, 01",
"1/1/1970, 12 PM – 1/2/1970, 1 AM",
"1/1/1970, 0 PM – 1/2/1970, 1 AM",
"1/1/1970, 12 PM – 1/2/1970, 1 AM",
"1/1/1970, 121/2/1970, 01",
"1/1/1970, 121/2/1970, 01",
],
},
// Noon to noon.
@ -128,11 +128,11 @@ let tests = {
start: 12,
end: 24 + 12,
data: [
"1/1/1970, 12\u202FPM\u2009–\u20091/2/1970, 12\u202FPM",
"1/1/1970, 0\u202FPM\u2009–\u20091/2/1970, 0\u202FPM",
"1/1/1970, 12\u202FPM\u2009–\u20091/2/1970, 12\u202FPM",
"1/1/1970, 12\u2009–\u20091/2/1970, 12",
"1/1/1970, 12\u2009–\u20091/2/1970, 12",
"1/1/1970, 12 PM – 1/2/1970, 12 PM",
"1/1/1970, 0 PM – 1/2/1970, 0 PM",
"1/1/1970, 12 PM – 1/2/1970, 12 PM",
"1/1/1970, 121/2/1970, 12",
"1/1/1970, 121/2/1970, 12",
],
},
// Noon to evening.
@ -140,11 +140,11 @@ let tests = {
start: 12,
end: 22,
data: [
"12\u2009–\u200910\u202FPM",
"0\u2009–\u200910\u202FPM",
"12\u2009–\u200910\u202FPM",
"12\u2009–\u200922",
"12\u2009–\u200922",
"12 – 10 PM",
"0 – 10 PM",
"12 – 10 PM",
"1222",
"1222",
],
},
// Noon to midnight.
@ -152,11 +152,11 @@ let tests = {
start: 12,
end: 24,
data: [
"1/1/1970, 12\u202FPM\u2009–\u20091/2/1970, 12\u202FAM",
"1/1/1970, 0\u202FPM\u2009–\u20091/2/1970, 0\u202FAM",
"1/1/1970, 12\u202FPM\u2009–\u20091/2/1970, 12\u202FAM",
"1/1/1970, 12\u2009–\u20091/2/1970, 00",
"1/1/1970, 12\u2009–\u20091/2/1970, 24",
"1/1/1970, 12 PM – 1/2/1970, 12 AM",
"1/1/1970, 0 PM – 1/2/1970, 0 AM",
"1/1/1970, 12 PM – 1/2/1970, 12 AM",
"1/1/1970, 121/2/1970, 00",
"1/1/1970, 121/2/1970, 24",
],
},
@ -165,11 +165,11 @@ let tests = {
start: 22,
end: 24 + 1,
data: [
"1/1/1970, 10\u202FPM\u2009–\u20091/2/1970, 1\u202FAM",
"1/1/1970, 10\u202FPM\u2009–\u20091/2/1970, 1\u202FAM",
"1/1/1970, 10\u202FPM\u2009–\u20091/2/1970, 1\u202FAM",
"1/1/1970, 22\u2009–\u20091/2/1970, 01",
"1/1/1970, 22\u2009–\u20091/2/1970, 01",
"1/1/1970, 10 PM – 1/2/1970, 1 AM",
"1/1/1970, 10 PM – 1/2/1970, 1 AM",
"1/1/1970, 10 PM – 1/2/1970, 1 AM",
"1/1/1970, 221/2/1970, 01",
"1/1/1970, 221/2/1970, 01",
],
},
// Evening to noon.
@ -177,11 +177,11 @@ let tests = {
start: 22,
end: 24 + 12,
data: [
"1/1/1970, 10\u202FPM\u2009–\u20091/2/1970, 12\u202FPM",
"1/1/1970, 10\u202FPM\u2009–\u20091/2/1970, 0\u202FPM",
"1/1/1970, 10\u202FPM\u2009–\u20091/2/1970, 12\u202FPM",
"1/1/1970, 22\u2009–\u20091/2/1970, 12",
"1/1/1970, 22\u2009–\u20091/2/1970, 12",
"1/1/1970, 10 PM – 1/2/1970, 12 PM",
"1/1/1970, 10 PM – 1/2/1970, 0 PM",
"1/1/1970, 10 PM – 1/2/1970, 12 PM",
"1/1/1970, 221/2/1970, 12",
"1/1/1970, 221/2/1970, 12",
],
},
// Evening to evening.
@ -189,11 +189,11 @@ let tests = {
start: 22,
end: 23,
data: [
"10\u2009–\u200911\u202FPM",
"10\u2009–\u200911\u202FPM",
"10\u2009–\u200911\u202FPM",
"22\u2009–\u200923",
"22\u2009–\u200923",
"10 – 11 PM",
"10 – 11 PM",
"10 – 11 PM",
"2223",
"2223",
],
},
// Evening to midnight.
@ -201,11 +201,11 @@ let tests = {
start: 22,
end: 24,
data: [
"1/1/1970, 10\u202FPM\u2009–\u20091/2/1970, 12\u202FAM",
"1/1/1970, 10\u202FPM\u2009–\u20091/2/1970, 0\u202FAM",
"1/1/1970, 10\u202FPM\u2009–\u20091/2/1970, 12\u202FAM",
"1/1/1970, 22\u2009–\u20091/2/1970, 00",
"1/1/1970, 22\u2009–\u20091/2/1970, 24",
"1/1/1970, 10 PM – 1/2/1970, 12 AM",
"1/1/1970, 10 PM – 1/2/1970, 0 AM",
"1/1/1970, 10 PM – 1/2/1970, 12 AM",
"1/1/1970, 221/2/1970, 00",
"1/1/1970, 221/2/1970, 24",
],
},
],
@ -217,8 +217,8 @@ let tests = {
end: 10,
data: [
"00–10 Uhr",
"0\u2009–\u200910 Uhr AM",
"12\u2009–\u200910 Uhr AM",
"010 Uhr AM",
"1210 Uhr AM",
"00–10 Uhr",
"24–10 Uhr",
],
@ -229,8 +229,8 @@ let tests = {
end: 12,
data: [
"00–12 Uhr",
"0 Uhr AM\u2009–\u20090 Uhr PM",
"12 Uhr AM\u2009–\u200912 Uhr PM",
"0 Uhr AM0 Uhr PM",
"12 Uhr AM12 Uhr PM",
"00–12 Uhr",
"24–12 Uhr",
],
@ -241,8 +241,8 @@ let tests = {
end: 22,
data: [
"00–22 Uhr",
"0 Uhr AM\u2009–\u200910 Uhr PM",
"12 Uhr AM\u2009–\u200910 Uhr PM",
"0 Uhr AM10 Uhr PM",
"12 Uhr AM10 Uhr PM",
"00–22 Uhr",
"24–22 Uhr",
],
@ -252,11 +252,11 @@ let tests = {
start: 0,
end: 24,
data: [
"1.1.1970, 00 Uhr\u2009–\u20092.1.1970, 00 Uhr",
"1.1.1970, 0 Uhr AM\u2009–\u20092.1.1970, 0 Uhr AM",
"1.1.1970, 12 Uhr AM\u2009–\u20092.1.1970, 12 Uhr AM",
"1.1.1970, 00 Uhr\u2009–\u20092.1.1970, 00 Uhr",
"1.1.1970, 24 Uhr\u2009–\u20092.1.1970, 24 Uhr",
"1.1.1970, 00 Uhr2.1.1970, 00 Uhr",
"1.1.1970, 0 Uhr AM2.1.1970, 0 Uhr AM",
"1.1.1970, 12 Uhr AM2.1.1970, 12 Uhr AM",
"1.1.1970, 00 Uhr2.1.1970, 00 Uhr",
"1.1.1970, 24 Uhr2.1.1970, 24 Uhr",
],
},
@ -266,8 +266,8 @@ let tests = {
end: 10,
data: [
"01–10 Uhr",
"1\u2009–\u200910 Uhr AM",
"1\u2009–\u200910 Uhr AM",
"110 Uhr AM",
"110 Uhr AM",
"01–10 Uhr",
"01–10 Uhr",
],
@ -278,8 +278,8 @@ let tests = {
end: 12,
data: [
"01–12 Uhr",
"1 Uhr AM\u2009–\u20090 Uhr PM",
"1 Uhr AM\u2009–\u200912 Uhr PM",
"1 Uhr AM0 Uhr PM",
"1 Uhr AM12 Uhr PM",
"01–12 Uhr",
"01–12 Uhr",
],
@ -290,8 +290,8 @@ let tests = {
end: 22,
data: [
"01–22 Uhr",
"1 Uhr AM\u2009–\u200910 Uhr PM",
"1 Uhr AM\u2009–\u200910 Uhr PM",
"1 Uhr AM10 Uhr PM",
"1 Uhr AM10 Uhr PM",
"01–22 Uhr",
"01–22 Uhr",
],
@ -301,11 +301,11 @@ let tests = {
start: 1,
end: 24,
data: [
"1.1.1970, 01 Uhr\u2009–\u20092.1.1970, 00 Uhr",
"1.1.1970, 1 Uhr AM\u2009–\u20092.1.1970, 0 Uhr AM",
"1.1.1970, 1 Uhr AM\u2009–\u20092.1.1970, 12 Uhr AM",
"1.1.1970, 01 Uhr\u2009–\u20092.1.1970, 00 Uhr",
"1.1.1970, 01 Uhr\u2009–\u20092.1.1970, 24 Uhr",
"1.1.1970, 01 Uhr2.1.1970, 00 Uhr",
"1.1.1970, 1 Uhr AM2.1.1970, 0 Uhr AM",
"1.1.1970, 1 Uhr AM2.1.1970, 12 Uhr AM",
"1.1.1970, 01 Uhr2.1.1970, 00 Uhr",
"1.1.1970, 01 Uhr2.1.1970, 24 Uhr",
],
},
@ -314,11 +314,11 @@ let tests = {
start: 12,
end: 24 + 1,
data: [
"1.1.1970, 12 Uhr\u2009–\u20092.1.1970, 01 Uhr",
"1.1.1970, 0 Uhr PM\u2009–\u20092.1.1970, 1 Uhr AM",
"1.1.1970, 12 Uhr PM\u2009–\u20092.1.1970, 1 Uhr AM",
"1.1.1970, 12 Uhr\u2009–\u20092.1.1970, 01 Uhr",
"1.1.1970, 12 Uhr\u2009–\u20092.1.1970, 01 Uhr",
"1.1.1970, 12 Uhr2.1.1970, 01 Uhr",
"1.1.1970, 0 Uhr PM2.1.1970, 1 Uhr AM",
"1.1.1970, 12 Uhr PM2.1.1970, 1 Uhr AM",
"1.1.1970, 12 Uhr2.1.1970, 01 Uhr",
"1.1.1970, 12 Uhr2.1.1970, 01 Uhr",
],
},
// Noon to noon.
@ -326,11 +326,11 @@ let tests = {
start: 12,
end: 24 + 12,
data: [
"1.1.1970, 12 Uhr\u2009–\u20092.1.1970, 12 Uhr",
"1.1.1970, 0 Uhr PM\u2009–\u20092.1.1970, 0 Uhr PM",
"1.1.1970, 12 Uhr PM\u2009–\u20092.1.1970, 12 Uhr PM",
"1.1.1970, 12 Uhr\u2009–\u20092.1.1970, 12 Uhr",
"1.1.1970, 12 Uhr\u2009–\u20092.1.1970, 12 Uhr",
"1.1.1970, 12 Uhr2.1.1970, 12 Uhr",
"1.1.1970, 0 Uhr PM2.1.1970, 0 Uhr PM",
"1.1.1970, 12 Uhr PM2.1.1970, 12 Uhr PM",
"1.1.1970, 12 Uhr2.1.1970, 12 Uhr",
"1.1.1970, 12 Uhr2.1.1970, 12 Uhr",
],
},
// Noon to evening.
@ -339,8 +339,8 @@ let tests = {
end: 22,
data: [
"12–22 Uhr",
"0\u2009–\u200910 Uhr PM",
"12\u2009–\u200910 Uhr PM",
"010 Uhr PM",
"1210 Uhr PM",
"12–22 Uhr",
"12–22 Uhr",
],
@ -350,11 +350,11 @@ let tests = {
start: 12,
end: 24,
data: [
"1.1.1970, 12 Uhr\u2009–\u20092.1.1970, 00 Uhr",
"1.1.1970, 0 Uhr PM\u2009–\u20092.1.1970, 0 Uhr AM",
"1.1.1970, 12 Uhr PM\u2009–\u20092.1.1970, 12 Uhr AM",
"1.1.1970, 12 Uhr\u2009–\u20092.1.1970, 00 Uhr",
"1.1.1970, 12 Uhr\u2009–\u20092.1.1970, 24 Uhr",
"1.1.1970, 12 Uhr2.1.1970, 00 Uhr",
"1.1.1970, 0 Uhr PM2.1.1970, 0 Uhr AM",
"1.1.1970, 12 Uhr PM2.1.1970, 12 Uhr AM",
"1.1.1970, 12 Uhr2.1.1970, 00 Uhr",
"1.1.1970, 12 Uhr2.1.1970, 24 Uhr",
],
},
@ -363,11 +363,11 @@ let tests = {
start: 22,
end: 24 + 1,
data: [
"1.1.1970, 22 Uhr\u2009–\u20092.1.1970, 01 Uhr",
"1.1.1970, 10 Uhr PM\u2009–\u20092.1.1970, 1 Uhr AM",
"1.1.1970, 10 Uhr PM\u2009–\u20092.1.1970, 1 Uhr AM",
"1.1.1970, 22 Uhr\u2009–\u20092.1.1970, 01 Uhr",
"1.1.1970, 22 Uhr\u2009–\u20092.1.1970, 01 Uhr",
"1.1.1970, 22 Uhr2.1.1970, 01 Uhr",
"1.1.1970, 10 Uhr PM2.1.1970, 1 Uhr AM",
"1.1.1970, 10 Uhr PM2.1.1970, 1 Uhr AM",
"1.1.1970, 22 Uhr2.1.1970, 01 Uhr",
"1.1.1970, 22 Uhr2.1.1970, 01 Uhr",
],
},
// Evening to noon.
@ -375,11 +375,11 @@ let tests = {
start: 22,
end: 24 + 12,
data: [
"1.1.1970, 22 Uhr\u2009–\u20092.1.1970, 12 Uhr",
"1.1.1970, 10 Uhr PM\u2009–\u20092.1.1970, 0 Uhr PM",
"1.1.1970, 10 Uhr PM\u2009–\u20092.1.1970, 12 Uhr PM",
"1.1.1970, 22 Uhr\u2009–\u20092.1.1970, 12 Uhr",
"1.1.1970, 22 Uhr\u2009–\u20092.1.1970, 12 Uhr",
"1.1.1970, 22 Uhr2.1.1970, 12 Uhr",
"1.1.1970, 10 Uhr PM2.1.1970, 0 Uhr PM",
"1.1.1970, 10 Uhr PM2.1.1970, 12 Uhr PM",
"1.1.1970, 22 Uhr2.1.1970, 12 Uhr",
"1.1.1970, 22 Uhr2.1.1970, 12 Uhr",
],
},
// Evening to evening.
@ -388,8 +388,8 @@ let tests = {
end: 23,
data: [
"22–23 Uhr",
"10\u2009–\u200911 Uhr PM",
"10\u2009–\u200911 Uhr PM",
"1011 Uhr PM",
"1011 Uhr PM",
"22–23 Uhr",
"22–23 Uhr",
],
@ -399,11 +399,11 @@ let tests = {
start: 22,
end: 24,
data: [
"1.1.1970, 22 Uhr\u2009–\u20092.1.1970, 00 Uhr",
"1.1.1970, 10 Uhr PM\u2009–\u20092.1.1970, 0 Uhr AM",
"1.1.1970, 10 Uhr PM\u2009–\u20092.1.1970, 12 Uhr AM",
"1.1.1970, 22 Uhr\u2009–\u20092.1.1970, 00 Uhr",
"1.1.1970, 22 Uhr\u2009–\u20092.1.1970, 24 Uhr",
"1.1.1970, 22 Uhr2.1.1970, 00 Uhr",
"1.1.1970, 10 Uhr PM2.1.1970, 0 Uhr AM",
"1.1.1970, 10 Uhr PM2.1.1970, 12 Uhr AM",
"1.1.1970, 22 Uhr2.1.1970, 00 Uhr",
"1.1.1970, 22 Uhr2.1.1970, 24 Uhr",
],
},
],

Просмотреть файл

@ -47,7 +47,7 @@ format = new Intl.DateTimeFormat("en-us", {
hour12: true,
timeZone: "UTC"});
assertParts(format, date, [
Hour("3"), Literal(":"), Minute("00"), Literal(":"), Second("42"), Literal("\u202F"), DayPeriod("AM"),
Hour("3"), Literal(":"), Minute("00"), Literal(":"), Second("42"), Literal(" "), DayPeriod("AM"),
]);
// Just month.
@ -89,7 +89,7 @@ format = new Intl.DateTimeFormat("en-us", {
assertParts(format, date, [
Weekday("Monday"), Literal(", "), Month("12"), Literal("/"), Day("17"), Literal("/"), Year("2012"),
Literal(", "),
Hour("3"), Literal(":"), Minute("00"), Literal(":"), Second("42"), Literal("\u202F"), DayPeriod("AM"),
Hour("3"), Literal(":"), Minute("00"), Literal(":"), Second("42"), Literal(" "), DayPeriod("AM"),
]);
if (typeof reportCompare === "function")

Просмотреть файл

@ -22,24 +22,24 @@ const tzMapper = [
const tests = [
{
timeZone: "UTC",
result: "12/6/2012, 12:00:00\u202FPM",
result: "12/6/2012, 12:00:00 PM",
},
{
timeZone: "America/Los_Angeles",
result: "12/6/2012, 4:00:00\u202FAM",
result: "12/6/2012, 4:00:00 AM",
},
{
timeZone: "America/New_York",
options: tzNameFormatOptions,
result: "12/6/2012, 7:00:00\u202FAM EST",
result: "12/6/2012, 7:00:00 AM EST",
},
{
timeZone: "America/Caracas",
result: "12/6/2012, 7:30:00\u202FAM",
result: "12/6/2012, 7:30:00 AM",
},
{
timeZone: "Europe/London",
result: "12/6/2012, 12:00:00\u202FPM",
result: "12/6/2012, 12:00:00 PM",
},
{
timeZone: "Africa/Casablanca",
@ -53,7 +53,7 @@ const tests = [
},
{
timeZone: "Asia/Kathmandu",
result: "12/6/2012, 5:45:00\u202FPM",
result: "12/6/2012, 5:45:00 PM",
},
{
timeZone: "Asia/Bangkok",
@ -67,27 +67,27 @@ const tests = [
},
{
timeZone: "Australia/Lord_Howe",
result: "12/6/2012, 11:00:00\u202FPM",
result: "12/6/2012, 11:00:00 PM",
},
{
timeZone: "Australia/Lord_Howe",
date: Date.UTC(2012, 7-1, 6, 12, 0, 0),
result: "7/6/2012, 10:30:00\u202FPM",
result: "7/6/2012, 10:30:00 PM",
},
{
timeZone: "Pacific/Kiritimati",
date: Date.UTC(1978, 12-1, 6, 12, 0, 0),
result: "12/6/1978, 1:20:00\u202FAM",
result: "12/6/1978, 1:20:00 AM",
},
{
timeZone: "Africa/Monrovia",
date: Date.UTC(1971, 12-1, 6, 12, 0, 0),
result: "12/6/1971, 11:15:30\u202FAM",
result: "12/6/1971, 11:15:30 AM",
},
{
timeZone: "Asia/Riyadh",
date: Date.UTC(1946, 12-1, 6, 12, 0, 0),
result: "12/6/1946, 3:06:52\u202FPM",
result: "12/6/1946, 3:06:52 PM",
},
];

Просмотреть файл

@ -13,7 +13,7 @@ const tests = [
options: {hour: "numeric", fractionalSecondDigits: 3},
parts: [
Hour("12"),
Literal("\u202F"),
Literal(" "),
DayPeriod("AM"),
Literal(" (Fractional Second: "),
FractionalSecond("123"),

Просмотреть файл

@ -53,8 +53,8 @@ for (const [key, value] of Object.entries(hourCycleToH12Map)) {
}
const expectedValuesENUS = {
h11: "0\u202FAM",
h12: "12\u202FAM",
h11: "0 AM",
h12: "12 AM",
h23: "00",
h24: "24"
};