blob: 725584e6b89cf0177ed101a09c92d43d473647a7 [file] [log] [blame]
// Copyright (c) 2011, 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.
// @dart = 2.9
/// @assertion DateTime toLocal()
/// Returns this in the local time zone.
/// Returns itself if it is already in the local time zone.
/// Otherwise, this method is equivalent to
/// new DateTime.fromMillisecondsSinceEpoch(millisecondsSinceEpoch, isUtc: false).
/// @description Checks that the method returns the correct value.
/// @author iefremov
import "../../../Utils/expect.dart";
check(millis) {
DateTime d = new DateTime.fromMillisecondsSinceEpoch(millis, isUtc: true);
Expect.equals(d.toLocal(), new DateTime.fromMillisecondsSinceEpoch(d.millisecondsSinceEpoch, isUtc: false));
}
main() {
DateTime d = new DateTime.now();
Expect.identical(d, d.toLocal());
check(0);
check(-1);
check(6031769);
check(8640000000000000);
check(-6031769);
check(-8640000000000000);
}