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

Unified Diff: sdk/lib/_internal/lib/js_helper.dart

Issue 54393004: Fix timezone name for IE. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 | « no previous file | tests/corelib/corelib.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/lib/js_helper.dart
diff --git a/sdk/lib/_internal/lib/js_helper.dart b/sdk/lib/_internal/lib/js_helper.dart
index b9da42c3c1306a8f0b76cb069e2da4076d67b616..98f9798a2cc211129e8d32e427dd9d627e2d449a 100644
--- a/sdk/lib/_internal/lib/js_helper.dart
+++ b/sdk/lib/_internal/lib/js_helper.dart
@@ -530,7 +530,25 @@ class Primitives {
// Example: "Wed May 16 2012 21:13:00 GMT+0200 (CEST)".
// We extract this name using a regexp.
var d = lazyAsJsDate(receiver);
- return JS('String', r'/\((.*)\)/.exec(#.toString())[1]', d);
+ String result = JS('String', r'/\((.*)\)/.exec(#.toString())[1]', d);
+ if (result == null) {
+ // Internet Explorer doesn't put the zone name into parenthesis:
+ // For example: Thu Oct 31 14:07:44 PDT 2013
+ result = JS('String',
+ // Thu followed by a space.
+ r'/^[A-Z,a-z]{3}\s'
+ // Oct 31 followed by space.
+ r'[A-Z,a-z]{3}\s\d+\s'
+ // Time followed by a space.
+ r'\d{2}:\d{2}:\d{2}\s'
+ // The time zone name followed by a space.
+ r'([A-Z]{3,5})\s'
+ // The year.
+ r'\d{4}$/'
+ '.exec(#.toString())[1]',
+ d);
+ }
+ return result;
}
static int getTimeZoneOffsetInMinutes(receiver) {
« no previous file with comments | « no previous file | tests/corelib/corelib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698