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

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

Issue 180873006: Update the Angular/DI tests to latest from github. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Review feedback Created 6 years, 10 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
« no previous file with comments | « third_party/pkg/angular/lib/filter/currency.dart ('k') | third_party/pkg/angular/lib/filter/filter.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/pkg/angular/lib/filter/date.dart
diff --git a/third_party/pkg/angular/lib/filter/date.dart b/third_party/pkg/angular/lib/filter/date.dart
index 7d6be47029ce13c9fc079f676e1a3da804491546..75d528703124c26779bb932eff0f3d4afc8d660a 100644
--- a/third_party/pkg/angular/lib/filter/date.dart
+++ b/third_party/pkg/angular/lib/filter/date.dart
@@ -21,9 +21,8 @@ part of angular.filter;
*
*/
@NgFilter(name:'date')
-class DateFilter {
-
- static Map<String, String> MAP = {
+class DateFilter implements Function {
+ static final _MAP = const <String, String> {
'medium': 'MMM d, y h:mm:ss a',
'short': 'M/d/yy h:mm a',
'fullDate': 'EEEE, MMMM d, y',
@@ -34,7 +33,7 @@ class DateFilter {
'shortTime': 'h:mm a',
};
- Map<num, NumberFormat> nfs = new Map<num, NumberFormat>();
+ var _dfs = <String, DateFormat>{};
/**
* [date]: Date to format either as Date object, milliseconds
@@ -48,18 +47,19 @@ class DateFilter {
* mediumDate is used
*
*/
- call(date, [format = r'mediumDate']) {
+ dynamic call(Object date, [String format = 'mediumDate']) {
if (date == '' || date == null) return date;
if (date is String) date = DateTime.parse(date);
if (date is num) date = new DateTime.fromMillisecondsSinceEpoch(date);
- if (!(date is DateTime)) return date;
- var nf = nfs[format];
- if (nf == null) {
- if (MAP.containsKey(format)) {
- format = MAP[format];
+ if (date is! DateTime) return date;
+ var df = _dfs[format];
+ if (df == null) {
+ if (_MAP.containsKey(format)) {
+ format = _MAP[format];
}
- nf = new DateFormat(format);
+ df = new DateFormat(format);
+ _dfs[format] = df;
}
- return nf.format(date);
+ return df.format(date);
}
}
« no previous file with comments | « third_party/pkg/angular/lib/filter/currency.dart ('k') | third_party/pkg/angular/lib/filter/filter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698