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

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

Issue 180843004: Revert revision 33053 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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
===================================================================
--- third_party/pkg/angular/lib/filter/date.dart (revision 33054)
+++ third_party/pkg/angular/lib/filter/date.dart (working copy)
@@ -21,8 +21,9 @@
*
*/
@NgFilter(name:'date')
-class DateFilter implements Function {
- static final _MAP = const <String, String> {
+class DateFilter {
+
+ static Map<String, String> MAP = {
'medium': 'MMM d, y h:mm:ss a',
'short': 'M/d/yy h:mm a',
'fullDate': 'EEEE, MMMM d, y',
@@ -33,7 +34,7 @@
'shortTime': 'h:mm a',
};
- var _dfs = <String, DateFormat>{};
+ Map<num, NumberFormat> nfs = new Map<num, NumberFormat>();
/**
* [date]: Date to format either as Date object, milliseconds
@@ -47,19 +48,18 @@
* mediumDate is used
*
*/
- dynamic call(Object date, [String format = 'mediumDate']) {
+ call(date, [format = r'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 df = _dfs[format];
- if (df == null) {
- if (_MAP.containsKey(format)) {
- format = _MAP[format];
+ if (!(date is DateTime)) return date;
+ var nf = nfs[format];
+ if (nf == null) {
+ if (MAP.containsKey(format)) {
+ format = MAP[format];
}
- df = new DateFormat(format);
- _dfs[format] = df;
+ nf = new DateFormat(format);
}
- return df.format(date);
+ return nf.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