Chromium Code Reviews| Index: pkg/intl/lib/date_format_helpers.dart |
| =================================================================== |
| --- pkg/intl/lib/date_format_helpers.dart (revision 11626) |
| +++ pkg/intl/lib/date_format_helpers.dart (working copy) |
| @@ -29,14 +29,14 @@ |
| /** |
| * Return a date built using our values. If no date portion is set, |
| - * use today's date, as otherwise the constructor will fail. |
| + * use the "Epoch" (January 1, 1970), since the constructor will fail if |
|
Anton Muhin
2012/08/30 17:44:03
nit: I think "since the constructor..." can be omi
Alan Knight
2012/08/30 17:50:40
Done.
|
| + * given zero values for those fields. |
| */ |
| Date asDate() { |
| if (year == 0 || month == 0 || day == 0) { |
| - var today = new Date.now(); |
| - if (year == 0) year = today.year; |
| - if (month == 0) month = today.month; |
| - if (day == 0) day = today.day; |
| + if (year == 0) year = 1970; |
|
Anton Muhin
2012/08/30 17:44:03
maybe just make those default values for fields?
Alan Knight
2012/08/30 17:50:40
Yes, that's much nicer. Done.
|
| + if (month == 0) month = 1; |
| + if (day == 0) day = 1; |
| } |
| // TODO(alanknight): Validate the date, especially for things which |