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

Unified Diff: corelib/src/date.dart

Issue 10384149: Refactor Date. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 8 years, 7 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 | « no previous file | corelib/src/time_zone.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: corelib/src/date.dart
diff --git a/corelib/src/date.dart b/corelib/src/date.dart
index c3da9d00d9475a8a512db2082e81c47ea26766b1..4a7c667cbdb0fb53bfd64b423964b4777ffae461 100644
--- a/corelib/src/date.dart
+++ b/corelib/src/date.dart
@@ -5,6 +5,21 @@
// Dart core library.
/**
+ * Returns the local time-zone as defined in the official zone.tab file.
+ *
+ * Examples: [:"Europe/Andorra":], [:"America/Los_Angeles":] or
+ * [:"Europe/Paris":].
+ *
+ * If the underlying implementation is unable to get the timezone string
+ * returns the offset to UTC prefixed with "GMT". Examples: [:"GMT+03":],
+ * [:"GMT-02":], or [:"GTM+04:30":].
+ */
+String get timeZoneName() => DateImplementation.timeZoneName();
+
+/** Returns the current local time-zone's offset to UTC. */
+Duration get timeZoneOffset() => DateImplementation.timeZoneOffset();
+
+/**
* Date is the public interface to a point in time.
*/
interface Date extends Comparable, Hashable default DateImplementation {
@@ -47,21 +62,8 @@ interface Date extends Comparable, Hashable default DateImplementation {
int milliseconds]);
/**
- * Constructs a [Date] instance based on the individual parts.
- * [timeZone] may not be [:null:].
- */
- Date.withTimeZone(int year,
- int month,
- int day,
- int hours,
- int minutes,
- int seconds,
- int milliseconds,
- TimeZone timeZone);
-
- /**
- * Constructs a new [Date] instance with current date time value.
- * The [timeZone] of this instance is set to the local time-zone.
+ * Constructs a new [Date] instance with current date time value in the
+ * local time-zone.
*/
Date.now();
@@ -71,16 +73,15 @@ interface Date extends Comparable, Hashable default DateImplementation {
Date.fromString(String formattedString);
/**
- * Constructs a new [Date] instance with the given time zone. The given
- * [timeZone] must not be [:null:].
+ * Constructs a new [Date] instance in the local time-zone.
*
* This constructor is the only one that doesn't need to be computations and
* which can therefore be [:const:].
*
* The constructed [Date] represents 1970-01-01T00:00:00Z + [value]ms in
- * the given [timeZone].
+ * the local time-zone.
*/
- const Date.fromEpoch(int value, TimeZone timeZone);
+ const Date.fromEpoch(int value);
/**
* Returns true if [this] occurs before [other]. The comparison is independent
@@ -104,15 +105,6 @@ interface Date extends Comparable, Hashable default DateImplementation {
bool operator >=(Date other);
/**
- * Returns a new [Date] in the given [targetTimeZone] time zone. The
- * [value] of the new instance is equal to [:this.value:].
- *
- * This call is equivalent to
- * [:new Date.fromEpoch(this.value, targetTimeZone):].
- */
- Date changeTimeZone(TimeZone targetTimeZone);
-
- /**
* Returns the year.
*/
int get year();
@@ -155,31 +147,22 @@ interface Date extends Comparable, Hashable default DateImplementation {
/**
* Returns milliseconds from 1970-01-01T00:00:00Z (UTC).
*
- * Note that this value is independent of [timeZone].
+ * Note that this value is independent of any time-zone.
*/
final int value;
/**
- * Returns the timeZone of this instance.
- */
- final TimeZone timeZone;
-
- /**
- * Returns true if this [Date] is set to local time.
- */
- bool isLocalTime();
-
- /**
- * Returns true if this [Date] is set to UTC time.
- * This is equivalent to [:this.timeZone.isUtc():].
+ * Returns a human readable string for this instance. The returned string
+ * is constructed in the local time-zone and does not have any time-zone
+ * indication. Example: [:2012-05-14 14:20:25.442:]
*/
- bool isUtc();
+ String toString();
/**
- * Returns a human readable string for this instance.
- * The returned string is constructed for the [timeZone] of this instance.
- */
- String toString();
+ * Returns a human readable string for this instance in UTC time-zone.
+ * Example: [:2012-05-14 12:21:04.989Z:]
+ */
+ String toUtcString();
/**
* Returns a new [Date] with the [duration] added to this instance.
« no previous file with comments | « no previous file | corelib/src/time_zone.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698