dart-sdk/tests/corelib/date_time_js_modified_test.dart
Riley Porter febb1929cd [ddc] Copy JS 2-digit year handling from dart2js.
Fixes https://github.com/dart-lang/sdk/issues/42894

Change-Id: I68a8782d123c299ec34bfd0a31b3108138dac117
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164681
Reviewed-by: Riley Porter <rileyporter@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Riley Porter <rileyporter@google.com>
2020-09-26 01:11:54 +00:00

17 lines
585 B
Dart

// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import "package:expect/expect.dart";
// The JavaScript Date constructor 'corrects' 2-digit years NN to 19NN.
// Verify that a DateTime with year 1 is created correctly.
// Regression test for https://github.com/dart-lang/sdk/issues/42894
main() {
var d = new DateTime(1, 0, 1, 0, 0, 0, 0);
var d2 = new DateTime(0, 12, 1, 0, 0, 0, 0);
Expect.equals(d, d2);
}