Bug 101878 - Add support for week/month to Locale::formatDateTime()
Summary: Add support for week/month to Locale::formatDateTime()
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Keishi Hattori
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-11 18:27 PST by Keishi Hattori
Modified: 2012-11-12 05:24 PST (History)
2 users (show)

See Also:


Attachments
Patch (6.35 KB, patch)
2012-11-12 02:28 PST, Keishi Hattori
no flags Details | Formatted Diff | Diff
Patch (7.18 KB, patch)
2012-11-12 03:51 PST, Keishi Hattori
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Keishi Hattori 2012-11-11 18:27:31 PST
Add support for week/month to Locale::formatDateTime()
Comment 1 Keishi Hattori 2012-11-12 02:28:27 PST
Created attachment 173592 [details]
Patch
Comment 2 Kent Tamura 2012-11-12 02:35:43 PST
Comment on attachment 173592 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=173592&action=review

> Source/WebCore/ChangeLog:10
> +        No new tests. Added Chromium tests LocaleMacTest.formatWeek and LocaleMacTest.formatMonth.

nit: "No new tests." is unnecessary.

> Source/WebCore/platform/text/PlatformLocale.cpp:102
>      case DateTimeFormat::FieldTypeMonth:

We need to support FieldTypeMonthStandAlone too.  Some locales such as Russian use it.

> Source/WebCore/platform/text/PlatformLocale.cpp:360
> -    if (date.type() != DateComponents::Time && date.type() != DateComponents::Date)
> +    if (date.type() != DateComponents::Time && date.type() != DateComponents::Date && date.type() != DateComponents::Week && date.type() != DateComponents::Month)
>          return String();

nit:
if (date.type() == DateComponents::DateTime || date.type() == DateComponents::DateTimeLocal || date.type() == DateComponents::Invalid)

is shorter.

> Source/WebCore/platform/text/PlatformLocale.cpp:371
>          builder.build(formatType == FormatTypeShort ? shortTimeFormat() : timeFormat());
>      else if (date.type() == DateComponents::Date)
>          builder.build(dateFormat());
> +    else if (date.type() == DateComponents::Week)
> +        builder.build(weekFormatInLDML());
> +    else if (date.type() == DateComponents::Month)
> +        builder.build(monthFormat());

nit: It's time to apply switch-case.
Comment 3 Keishi Hattori 2012-11-12 03:51:43 PST
Created attachment 173613 [details]
Patch
Comment 4 WebKit Review Bot 2012-11-12 05:24:07 PST
Comment on attachment 173613 [details]
Patch

Clearing flags on attachment: 173613

Committed r134216: <http://trac.webkit.org/changeset/134216>
Comment 5 WebKit Review Bot 2012-11-12 05:24:10 PST
All reviewed patches have been landed.  Closing bug.