Chromium Code Reviews| Index: lib/i18n/date_format.dart |
| diff --git a/lib/i18n/date_format.dart b/lib/i18n/date_format.dart |
| index 447ec9c47505ae51a7215d08857cea2e60355146..f065e1c73f5bd1fcd29ca3a89742d87e06a1fafd 100644 |
| --- a/lib/i18n/date_format.dart |
| +++ b/lib/i18n/date_format.dart |
| @@ -3,10 +3,10 @@ |
| * for details. All rights reserved. Use of this source code is governed by a |
| * BSD-style license that can be found in the LICENSE file. |
| * |
| - * DateFormat is for formatting and parsing dates in a locale-sensitive |
| - * manner. |
| - * It allows the user to use any customized pattern to parse or format |
| - * date-time strings under certain locales. Date elements that vary across |
| + * DateFormat is for formatting and parsing dates in a locale-sensitive |
| + * manner. |
| + * It allows the user to use any customized pattern to parse or format |
| + * date-time strings under certain locales. Date elements that vary across |
| * locales include month name, weekname, field, order, etc. |
| * |
| * This library uses the ICU/JDK date/time pattern specification as described |
| @@ -104,11 +104,21 @@ |
| class DateFormat { |
| - /** Definition of this object formats dates. */ |
| + /** |
| + * Definition of how this object formats dates. |
| + * (TODO) alanknight This might just be a String, but it's not clear yet. |
| + */ |
| var formatDefinition; |
| + /** |
| + * The locale we use to format dates. |
| + * (TODO) alanknight Is there a Locale type? Or is this just a string? |
| + */ |
| + var locale; |
| + |
| + |
| /** Date/Time format patterns. */ |
|
Emily Fortuna
2012/06/06 22:57:33
120-134 is all indented one extra space. not such
|
| - // TODO(alanknight): There's a style question of whether to use fullDate or |
| + // TODO(alanknight): There's a style question of whether to use fullDate or |
| // FULL_DATE naming conventions. |
| static final int _fullDate = 0; |
| static final int _longDate = 1; |
| @@ -122,11 +132,9 @@ class DateFormat { |
| static final int _longDateTime = 9; |
| static final int _mediumDateTime = 10; |
| static final int _shortDateTime = 11; |
| - |
| + |
| /** |
| * Named constructors for each of the above values. |
| - * These could probably be made shorter if we just set the format to the |
| - * constant and the parsing was lazy. |
| */ |
| DateFormat.fullDate() : this.formatDefinition = _fullDate; |
| DateFormat.longDate() : this.formatDefinition = _longDate; |
| @@ -140,18 +148,28 @@ class DateFormat { |
| DateFormat.longDateTime() : this.formatDefinition = _longDateTime; |
| DateFormat.mediumDateTime() : this.formatDefinition = _mediumDateTime; |
| DateFormat.shortDateTime() : this.formatDefinition = _shortDateTime; |
| - |
| + |
| + /** |
| + * Explicit constructor given a particular format |
|
Emily Fortuna
2012/06/06 22:57:33
comment must end in period.
Alan Knight
2012/06/06 23:08:09
Done.
|
| + */ |
| DateFormat(this.formatDefinition); |
| /** |
| - * |
| + * Constructors for dates/times that use a default format. |
| + */ |
| + DateFormat.date([this.locale]) : formatDefinition = _fullDate; |
| + DateFormat.time() : formatDefinition = _fullTime; |
| + DateFormat.dateTime() : formatDefinition = _fullDateTime; |
| + |
| + /** |
| + * |
| */ |
| String parse(String inputString) { |
| return inputString; |
| } |
| /** |
| - * Format the given [date] object according to preset pattern and current |
| + * Format the given [date] object according to preset pattern and current |
| * locale and return a formated string for the given date. |
| */ |
| String format(Date date, [TimeZone timeZone]) { |