| Index: corelib/src/implementation/date.dart
|
| diff --git a/corelib/unified/core/implementation/date.dart b/corelib/src/implementation/date.dart
|
| similarity index 91%
|
| rename from corelib/unified/core/implementation/date.dart
|
| rename to corelib/src/implementation/date.dart
|
| index 9d88a04c6c0554cfe9ae34ee3eed1c829c39b198..9bf9cac92252d621b9b9d498efa9a5ef16b25c5c 100644
|
| --- a/corelib/unified/core/implementation/date.dart
|
| +++ b/corelib/src/implementation/date.dart
|
| @@ -17,7 +17,7 @@ class DateImplementation implements Date {
|
| // - "2012-02-27T14Z"
|
| // - "-123450101 00:00:00 Z" // In the year -12345.
|
| final RegExp re = const RegExp(
|
| - @'^([+-]?\d?\d\d\d\d)-?(\d\d)-?(\d\d)' // The day part.
|
| + @'^([+-]?\d?\d\d\d\d)-?(\d\d)-?(\d\d)' // The day part.
|
| @'(?:[ T](\d\d)(?::?(\d\d)(?::?(\d\d)(.\d{1,6})?)?)? ?([zZ])?)?$');
|
| Match match = re.firstMatch(formattedString);
|
| if (match !== null) {
|
| @@ -47,7 +47,7 @@ class DateImplementation implements Date {
|
| }
|
| // TODO(floitsch): we should not need to test against the empty string.
|
| bool isUtc = (match[8] !== null) && (match[8] != "");
|
| - int millisecondsSinceEpoch = Primitives.valueFromDecomposedDate(
|
| + int millisecondsSinceEpoch = _brokenDownDateToMillisecondsSinceEpoch(
|
| years, month, day, hour, minute, second, millisecond, isUtc);
|
| if (millisecondsSinceEpoch === null) {
|
| throw new IllegalArgumentException(formattedString);
|
| @@ -138,21 +138,21 @@ class DateImplementation implements Date {
|
| }
|
| }
|
|
|
| - // Adds the [duration] to this Date instance.
|
| + /** Returns a new [Date] with the [duration] added to [this]. */
|
| Date add(Duration duration) {
|
| int ms = millisecondsSinceEpoch;
|
| return new Date.fromMillisecondsSinceEpoch(
|
| ms + duration.inMilliseconds, isUtc);
|
| }
|
|
|
| - // Subtracts the [duration] from this Date instance.
|
| + /** Returns a new [Date] with the [duration] subtracted from [this]. */
|
| Date subtract(Duration duration) {
|
| int ms = millisecondsSinceEpoch;
|
| return new Date.fromMillisecondsSinceEpoch(
|
| ms - duration.inMilliseconds, isUtc);
|
| }
|
|
|
| - // Returns a [Duration] with the difference of [this] and [other].
|
| + /** Returns a [Duration] with the difference of [this] and [other]. */
|
| Duration difference(Date other) {
|
| int ms = millisecondsSinceEpoch;
|
| int otherMs = other.millisecondsSinceEpoch;
|
| @@ -168,6 +168,9 @@ class DateImplementation implements Date {
|
| int millisecond,
|
| bool isUtc]);
|
| external DateImplementation.now();
|
| + external static int _brokenDownDateToMillisecondsSinceEpoch(
|
| + int years, int month, int day, int hour, int minute, int second,
|
| + int millisecond, bool isUtc);
|
| external String get timeZoneName();
|
| external Duration get timeZoneOffset();
|
| external int get year();
|
|
|