| 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 507e89b59ca1481ef67033c3cb4221bc38bcd52a..7e753ef160c00c8277862e632ea5cf588e36f39b 100644
|
| --- a/sdk/lib/_internal/lib/js_helper.dart
|
| +++ b/sdk/lib/_internal/lib/js_helper.dart
|
| @@ -518,29 +518,37 @@ class Primitives {
|
| }
|
|
|
| static String getTimeZoneName(receiver) {
|
| - // When calling toString on a Date it will emit the timezone in parenthesis.
|
| + // Firefox and Chrome emit the timezone in parenthesis.
|
| // Example: "Wed May 16 2012 21:13:00 GMT+0200 (CEST)".
|
| // We extract this name using a regexp.
|
| var d = lazyAsJsDate(receiver);
|
| - 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;
|
| + List match = JS('JSArray|Null', r'/\((.*)\)/.exec(#.toString())', d);
|
| + if (match != null) return match[1];
|
| +
|
| + // Internet Explorer 10+ emits the zone name without parenthesis:
|
| + // Example: Thu Oct 31 14:07:44 PDT 2013
|
| + match = JS('JSArray|Null',
|
| + // 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())',
|
| + d);
|
| + if (match != null) return match[1];
|
| +
|
| + // IE 9 and Opera don't provide the zone name. We fall back to emitting the
|
| + // UTC/GMT offset.
|
| + // Example (IE9): Wed Nov 20 09:51:00 UTC+0100 2013
|
| + // (Opera): Wed Nov 20 2013 11:03:38 GMT+0100
|
| + match = JS('JSArray|Null', r'/(?:GMT|UTC)[+-]\d{4}/.exec(#.toString())', d);
|
| + if (match != null) return match[0];
|
| + return "";
|
| }
|
|
|
| static int getTimeZoneOffsetInMinutes(receiver) {
|
|
|