Chromium Code Reviews| Index: corelib/src/date.dart |
| diff --git a/corelib/src/date.dart b/corelib/src/date.dart |
| index 5d16677799638e73a5d5306cc41ca36a45b3e786..7a05cf8404a37ca0223163b6d4920c5534d45042 100644 |
| --- a/corelib/src/date.dart |
| +++ b/corelib/src/date.dart |
| @@ -5,9 +5,27 @@ |
| // 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 correct timezone |
| + * returns the offset to UTC. Examples: [:"GMT+03":], [:"GMT-02":], or |
| + * [:"GTM+04:30":]. |
| + */ |
| +String get localTimeZone() => DateImplementation.localTimeZone(); |
| +/** Returns the current local time-zone's offset to UTC. */ |
| +int get timeZoneOffsetInMinutes() |
|
Sean Eagan
2012/05/14 14:43:51
this should return a Duration instead of hard code
floitsch
2012/05/14 15:01:16
good catch.
|
| + => DateImplementation.timeZoneOffsetInMinutes(); |
| +/** Returns true if the local time-zone is currently in summer-savings mode. */ |
| +bool get summerTimeSavingsIsActive() |
|
Sean Eagan
2012/05/14 14:43:51
it looks like this tries to combine the terms 'day
floitsch
2012/05/14 15:01:16
my mistake. I wanted to write DaylightSavingsTimeI
Sean Eagan
2012/05/14 16:05:16
oh, I thought this was an instance method on Date.
floitsch
2012/05/14 16:12:11
Yes and no. It is both a property of a specific Da
|
| + => DateImplementation.summerTimeSavingsIsActive(); |
| + |
| +/** |
| * Date is the public interface to a point in time. |
| */ |
| -interface Date extends Comparable default DateImplementation { |
| +interface Date extends Comparable, Hashable default DateImplementation { |
| // Weekday constants that are returned by [weekday] method: |
| static final int MON = 0; |
| static final int TUE = 1; |
| @@ -37,29 +55,16 @@ interface Date extends Comparable default DateImplementation { |
| * local time-zone. |
| */ |
| Date(int year, |
| - int month, |
| - int day, |
| - int hours, |
| - int minutes, |
| - int seconds, |
| - 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); |
| + [int month = 1, |
| + int day = 1, |
| + int hours = 0, |
| + int minutes = 0, |
| + int seconds = 0, |
| + int milliseconds = 0]); |
| /** |
| - * 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(); |
| @@ -69,25 +74,20 @@ interface Date extends Comparable 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 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); |
| + bool operator <(Date other); |
| + bool operator <=(Date other); |
| + bool operator >=(Date other); |
| + bool operator >(Date other); |
| /** |
| * Returns the year. |
| @@ -132,31 +132,22 @@ interface Date extends Comparable 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. |
| + * 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:] |
| */ |
| - 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():]. |
| - */ |
| - 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:] |
|
floitsch
2012/05/14 15:01:16
Should we instead return a valid ISO 8601? It woul
|
| + */ |
| + String toUTCString(); |
|
Sean Eagan
2012/05/14 14:43:51
toUtcString
per the Dart style guide
floitsch
2012/05/14 15:01:16
Done.
|
| /** |
| * Returns a new [Date] with the [duration] added to this instance. |