mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Bug 1672548 - Add weekday skeleton to DateTimeFormat::FormatDateTime(). r=gregtatum
Differential Revision: https://phabricator.services.mozilla.com/D119545
This commit is contained in:
parent
87cba8f0f4
commit
22f3732905
@ -81,6 +81,12 @@ nsresult DateTimeFormat::FormatDateTime(
|
||||
case Skeleton::yyyyMMMM:
|
||||
skeleton.AssignASCII("yyyyMMMM");
|
||||
break;
|
||||
case Skeleton::E:
|
||||
skeleton.AssignASCII("E");
|
||||
break;
|
||||
case Skeleton::EEEE:
|
||||
skeleton.AssignASCII("EEEE");
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("Unhandled skeleton enum");
|
||||
}
|
||||
|
@ -37,7 +37,8 @@ class DateTimeFormat {
|
||||
|
||||
enum class Style { Wide, Abbreviated };
|
||||
|
||||
enum class Skeleton { yyyyMM, yyyyMMMM };
|
||||
// Weekday (E, EEEE) only used in Thunderbird.
|
||||
enum class Skeleton { yyyyMM, yyyyMMMM, E, EEEE };
|
||||
|
||||
// performs a locale sensitive date formatting operation on the PRTime
|
||||
// parameter
|
||||
|
@ -223,6 +223,16 @@ TEST(DateTimeFormat, DateFormatSelectorsForeign)
|
||||
ASSERT_TRUE(NS_SUCCEEDED(rv));
|
||||
ASSERT_STREQ("Januar 1970", NS_ConvertUTF16toUTF8(formattedTime).get());
|
||||
|
||||
rv = mozilla::DateTimeFormat::FormatDateTime(
|
||||
&prExplodedTime, DateTimeFormat::Skeleton::E, formattedTime);
|
||||
ASSERT_TRUE(NS_SUCCEEDED(rv));
|
||||
ASSERT_STREQ("Do", NS_ConvertUTF16toUTF8(formattedTime).get());
|
||||
|
||||
rv = mozilla::DateTimeFormat::FormatDateTime(
|
||||
&prExplodedTime, DateTimeFormat::Skeleton::EEEE, formattedTime);
|
||||
ASSERT_TRUE(NS_SUCCEEDED(rv));
|
||||
ASSERT_STREQ("Donnerstag", NS_ConvertUTF16toUTF8(formattedTime).get());
|
||||
|
||||
rv = mozilla::DateTimeFormat::GetCalendarSymbol(
|
||||
mozilla::DateTimeFormat::Field::Month,
|
||||
mozilla::DateTimeFormat::Style::Wide, &prExplodedTime, formattedTime);
|
||||
|
Loading…
Reference in New Issue
Block a user