Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(214)

Unified Diff: lib/compiler/implementation/lib/mockimpl.dart

Issue 10532068: Revert "Remove deprecated classes and functions in Date." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/compiler/implementation/lib/core.dart ('k') | lib/compiler/implementation/scanner/source_list.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/lib/mockimpl.dart
diff --git a/lib/compiler/implementation/lib/mockimpl.dart b/lib/compiler/implementation/lib/mockimpl.dart
index 08648b963210d8818313dab8ad876dd86f21a81e..4dccbcdc021ed75be2a2fbb96deda524be8cbcf2 100644
--- a/lib/compiler/implementation/lib/mockimpl.dart
+++ b/lib/compiler/implementation/lib/mockimpl.dart
@@ -166,6 +166,18 @@ class StringBase {
}
}
+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;
+}
+
class DateImplementation implements Date {
final int value;
final bool _isUtc;
@@ -184,6 +196,17 @@ class DateImplementation implements Date {
_asJs();
}
+ DateImplementation.withTimeZone(int years,
+ int month,
+ int day,
+ int hours,
+ int minutes,
+ int seconds,
+ int milliseconds,
+ TimeZoneImplementation timeZone)
+ : this(years, month, day, hours, minutes, seconds, milliseconds,
+ timeZone.isUtc);
+
DateImplementation.now()
: _isUtc = false,
value = Primitives.dateNow() {
@@ -273,6 +296,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 Primitives.getTimeZoneName(this);
« no previous file with comments | « lib/compiler/implementation/lib/core.dart ('k') | lib/compiler/implementation/scanner/source_list.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698