| Index: sdk/lib/_internal/js_runtime/lib/js_helper.dart
|
| diff --git a/sdk/lib/_internal/js_runtime/lib/js_helper.dart b/sdk/lib/_internal/js_runtime/lib/js_helper.dart
|
| index eb81e0c130dc57fc5afe29ef9806c1c02aed99a7..96c3f3c3a631bcd9dffb55e1e2c1ba0dea81a24a 100644
|
| --- a/sdk/lib/_internal/js_runtime/lib/js_helper.dart
|
| +++ b/sdk/lib/_internal/js_runtime/lib/js_helper.dart
|
| @@ -1106,6 +1106,14 @@ class Primitives {
|
| checkInt(milliseconds);
|
| checkBool(isUtc);
|
| var jsMonth = month - 1;
|
| + // The JavaScript Date constructor 'corrects' year NN to 19NN. Sidestep that
|
| + // correction by adjusting years out of that range and compensating with an
|
| + // adjustment of months. This hack should not be sensitive to leap years but
|
| + // use 400 just in case.
|
| + if (0 <= years && years < 100) {
|
| + years += 400;
|
| + jsMonth -= 400 * 12;
|
| + }
|
| var value;
|
| if (isUtc) {
|
| value = JS('num', r'Date.UTC(#, #, #, #, #, #, #)', years, jsMonth, day,
|
| @@ -1119,24 +1127,9 @@ class Primitives {
|
| value > MAX_MILLISECONDS_SINCE_EPOCH) {
|
| return null;
|
| }
|
| - // The JavaScript Date constructor 'corrects' year NN to 19NN. Undo that
|
| - // correction.
|
| - if (0 <= years && years < 100) return patchUpY2K(value, years, isUtc);
|
| return JS('int', '#', value);
|
| }
|
|
|
| - static patchUpY2K(value, years, isUtc) {
|
| - var date = JS('', r'new Date(#)', value);
|
| - // TODO(sra): Does this work correctly if the original input wrapped months
|
| - // into a different year?
|
| - if (isUtc) {
|
| - JS('num', r'#.setUTCFullYear(#)', date, years);
|
| - } else {
|
| - JS('num', r'#.setFullYear(#)', date, years);
|
| - }
|
| - return JS('num', r'#.valueOf()', date);
|
| - }
|
| -
|
| // Lazily keep a JS Date stored in the JS object.
|
| static lazyAsJsDate(DateTime receiver) {
|
| if (JS('bool', r'#.date === (void 0)', receiver)) {
|
|
|