| Index: runtime/lib/date.dart
|
| diff --git a/runtime/lib/date.dart b/runtime/lib/date.dart
|
| index d39fb8cf92fc4108caf1d4f1583de18d838fc8c2..1654da7f6eaa355eb364c4e29de91bfff6a1c7c9 100644
|
| --- a/runtime/lib/date.dart
|
| +++ b/runtime/lib/date.dart
|
| @@ -3,6 +3,18 @@
|
| // BSD-style license that can be found in the LICENSE file.
|
| // Dart core library.
|
|
|
| +class TimeZoneImplementation implements TimeZone {
|
| + const TimeZoneImplementation.utc() : isUtc = true;
|
| + TimeZoneImplementation.local() : isUtc = false {}
|
| +
|
| + bool operator ==(Object other) {
|
| + if (!(other is TimeZoneImplementation)) return false;
|
| + return isUtc == other.isUtc;
|
| + }
|
| +
|
| + final bool isUtc;
|
| +}
|
| +
|
| // VM implementation of DateImplementation.
|
| class DateImplementation implements Date {
|
| static final int _SECONDS_YEAR_2035 = 2051222400;
|
| @@ -21,6 +33,17 @@ class DateImplementation implements Date {
|
| if (value === null) throw new IllegalArgumentException();
|
| }
|
|
|
| + DateImplementation.withTimeZone(int years,
|
| + int month,
|
| + int day,
|
| + int hours,
|
| + int minutes,
|
| + int seconds,
|
| + int milliseconds,
|
| + TimeZone timeZone)
|
| + : this(years, month, day, hours, minutes, seconds, milliseconds,
|
| + timeZone.isUtc);
|
| +
|
| DateImplementation.now()
|
| : _isUtc = true,
|
| value = _getCurrentMs() {
|
| @@ -108,6 +131,13 @@ class DateImplementation implements Date {
|
| return new DateImplementation.fromEpoch(value, true);
|
| }
|
|
|
| + Date changeTimeZone(TimeZone targetTimeZone) {
|
| + if (targetTimeZone === null) {
|
| + targetTimeZone = new TimeZoneImplementation.local();
|
| + }
|
| + return new Date.fromEpoch(value, targetTimeZone.isUtc);
|
| + }
|
| +
|
| String get timeZoneName() {
|
| if (isUtc()) return "UTC";
|
| return _timeZoneName(_equivalentSeconds(_secondsSinceEpoch));
|
|
|