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

Side by Side Diff: packages/charted/lib/locale/format/time_format.dart

Issue 2213693002: Updated charted DEP to 0.4.X (Closed) Base URL: https://github.com/dart-lang/observatory_pub_packages.git@master
Patch Set: Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. All rights reserved. 2 * Copyright 2014 Google Inc. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style 4 * Use of this source code is governed by a BSD-style
5 * license that can be found in the LICENSE file or at 5 * license that can be found in the LICENSE file or at
6 * https://developers.google.com/open-source/licenses/bsd 6 * https://developers.google.com/open-source/licenses/bsd
7 */ 7 */
8 part of charted.locale.format; 8 part of charted.locale.format;
9 9
10 typedef String TimeFormatFunction(DateTime date); 10 typedef String TimeFormatFunction(DateTime date);
(...skipping 26 matching lines...) Expand all
37 DateTime parse(String string) { 37 DateTime parse(String string) {
38 assert(_dateFormat != null); 38 assert(_dateFormat != null);
39 return _dateFormat.parse(string); 39 return _dateFormat.parse(string);
40 } 40 }
41 41
42 TimeFormatFunction multi(List<List> formats) { 42 TimeFormatFunction multi(List<List> formats) {
43 var n = formats.length, i = -1; 43 var n = formats.length, i = -1;
44 while (++i < n) formats[i][0] = _getInstance(formats[i][0] as String); 44 while (++i < n) formats[i][0] = _getInstance(formats[i][0] as String);
45 return (var date) { 45 return (var date) {
46 if (date is num) { 46 if (date is num) {
47 date = new DateTime.fromMillisecondsSinceEpoch(date.toInt()); 47 date = new DateTime.fromMillisecondsSinceEpoch((date as num).toInt());
48 } 48 }
49 var i = 0, f = formats[i]; 49 var i = 0, f = formats[i];
50 while (f.length < 2 || f[1](date) == false) { 50 while (f.length < 2 || f[1](date) == false) {
51 i++; 51 i++;
52 if (i < n) f = formats[i]; 52 if (i < n) f = formats[i];
53 } 53 }
54 if (i == n) return null; 54 if (i == n) return null;
55 return f[0].apply(date); 55 return f[0].apply(date);
56 }; 56 };
57 } 57 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 119
120 UTCTimeFormat _getInstance(String template) { 120 UTCTimeFormat _getInstance(String template) {
121 return new UTCTimeFormat(template, _locale); 121 return new UTCTimeFormat(template, _locale);
122 } 122 }
123 123
124 DateTime parse(String string) { 124 DateTime parse(String string) {
125 assert(_dateFormat != null); 125 assert(_dateFormat != null);
126 return _dateFormat.parseUTC(string); 126 return _dateFormat.parseUTC(string);
127 } 127 }
128 } 128 }
OLDNEW
« no previous file with comments | « packages/charted/lib/locale/format/number_format.dart ('k') | packages/charted/lib/selection/selection.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698