OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of intl; | 5 part of intl; |
6 | 6 |
7 // TODO(efortuna): Customized pattern system -- suggested by i18n needs | 7 // TODO(efortuna): Customized pattern system -- suggested by i18n needs |
8 // feedback on appropriateness. | 8 // feedback on appropriateness. |
9 /** | 9 /** |
10 * DateFormat is for formatting and parsing dates in a locale-sensitive | 10 * DateFormat is for formatting and parsing dates in a locale-sensitive |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 throw new FormatException( | 284 throw new FormatException( |
285 "Characters remaining after date parsing in $inputString"); | 285 "Characters remaining after date parsing in $inputString"); |
286 } | 286 } |
287 if (strict) dateFields.verify(inputString); | 287 if (strict) dateFields.verify(inputString); |
288 return dateFields.asDate(); | 288 return dateFields.asDate(); |
289 } | 289 } |
290 | 290 |
291 /** | 291 /** |
292 * Given user input, attempt to parse the [inputString] into the anticipated | 292 * Given user input, attempt to parse the [inputString] into the anticipated |
293 * format, treating it as being in UTC. | 293 * format, treating it as being in UTC. |
| 294 * |
| 295 * The canonical Dart style name |
| 296 * is [parseUtc], but [parseUTC] is retained |
| 297 * for backward-compatibility. |
294 */ | 298 */ |
295 DateTime parseUTC(String inputString) => parse(inputString, true); | 299 DateTime parseUTC(String inputString) => parse(inputString, true); |
296 | 300 |
297 /** | 301 /** |
| 302 * Given user input, attempt to parse the [inputString] into the anticipated |
| 303 * format, treating it as being in UTC. |
| 304 * |
| 305 * The canonical Dart style name |
| 306 * is [parseUtc], but [parseUTC] is retained |
| 307 * for backward-compatibility. |
| 308 */ |
| 309 DateTime parseUtc(String inputString) => parse(inputString, true); |
| 310 |
| 311 /** |
298 * Return the locale code in which we operate, e.g. 'en_US' or 'pt'. | 312 * Return the locale code in which we operate, e.g. 'en_US' or 'pt'. |
299 */ | 313 */ |
300 String get locale => _locale; | 314 String get locale => _locale; |
301 | 315 |
302 /** | 316 /** |
303 * Returns a list of all locales for which we have date formatting | 317 * Returns a list of all locales for which we have date formatting |
304 * information. | 318 * information. |
305 */ | 319 */ |
306 static List<String> allLocalesWithSymbols() => dateTimeSymbols.keys.toList(); | 320 static List<String> allLocalesWithSymbols() => dateTimeSymbols.keys.toList(); |
307 | 321 |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 _DateFormatField _match(String pattern) { | 621 _DateFormatField _match(String pattern) { |
608 for (var i = 0; i < _matchers.length; i++) { | 622 for (var i = 0; i < _matchers.length; i++) { |
609 var regex = _matchers[i]; | 623 var regex = _matchers[i]; |
610 var match = regex.firstMatch(pattern); | 624 var match = regex.firstMatch(pattern); |
611 if (match != null) { | 625 if (match != null) { |
612 return _fieldConstructors[i](match.group(0), this); | 626 return _fieldConstructors[i](match.group(0), this); |
613 } | 627 } |
614 } | 628 } |
615 } | 629 } |
616 } | 630 } |
OLD | NEW |