Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: third_party/pkg/angular/lib/formatter/date.dart

Issue 257423008: Update all Angular libs (run update_all.sh). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/pkg/angular/lib/formatter/date.dart
diff --git a/third_party/pkg/angular/lib/filter/date.dart b/third_party/pkg/angular/lib/formatter/date.dart
similarity index 82%
rename from third_party/pkg/angular/lib/filter/date.dart
rename to third_party/pkg/angular/lib/formatter/date.dart
index 75d528703124c26779bb932eff0f3d4afc8d660a..0268b468df77c5c7f19f1565c65b01650e676cb9 100644
--- a/third_party/pkg/angular/lib/filter/date.dart
+++ b/third_party/pkg/angular/lib/formatter/date.dart
@@ -1,4 +1,4 @@
-part of angular.filter;
+part of angular.formatter_internal;
/**
* Formats date to a string based on the requested format.
@@ -20,8 +20,8 @@ part of angular.filter;
* {{ date_expression | date[:format] }}
*
*/
-@NgFilter(name:'date')
-class DateFilter implements Function {
+@Formatter(name:'date')
+class Date implements Function {
static final _MAP = const <String, String> {
'medium': 'MMM d, y h:mm:ss a',
'short': 'M/d/yy h:mm a',
@@ -33,7 +33,7 @@ class DateFilter implements Function {
'shortTime': 'h:mm a',
};
- var _dfs = <String, DateFormat>{};
+ var _dfs = new Map<String, Map<String, DateFormat>>();
/**
* [date]: Date to format either as Date object, milliseconds
@@ -52,13 +52,13 @@ class DateFilter implements Function {
if (date is String) date = DateTime.parse(date);
if (date is num) date = new DateTime.fromMillisecondsSinceEpoch(date);
if (date is! DateTime) return date;
- var df = _dfs[format];
+ if (_MAP.containsKey(format)) format = _MAP[format];
+ var verifiedLocale = Intl.verifiedLocale(Intl.getCurrentLocale(), DateFormat.localeExists);
+ _dfs.putIfAbsent(verifiedLocale, () => new Map<String, DateFormat>());
+ var df = _dfs[verifiedLocale][format];
if (df == null) {
- if (_MAP.containsKey(format)) {
- format = _MAP[format];
- }
df = new DateFormat(format);
- _dfs[format] = df;
+ _dfs[verifiedLocale][format] = df;
}
return df.format(date);
}
« no previous file with comments | « third_party/pkg/angular/lib/formatter/currency.dart ('k') | third_party/pkg/angular/lib/formatter/filter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698