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

Unified Diff: lib/core/date.dart

Issue 11090016: Change core lib, dart2js, and more for new optional parameters syntax (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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/samples/leap/leap_leg.dart ('k') | lib/coreimpl/date.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/core/date.dart
===================================================================
--- lib/core/date.dart (revision 13683)
+++ lib/core/date.dart (working copy)
@@ -40,10 +40,10 @@
/**
* Constructs a [Date] instance based on the individual parts. The date is
- * in the local time zone if [isUtc] is false.
+ * in the local time zone.
*
* [month] and [day] are one-based. For example
- * [:new Date(1938, 1, 10)] represents the 10th of January 1938.
+ * [:new Date(1938, 1, 10):] represents the 10th of January 1938.
*/
factory Date(int year,
[int month = 1,
@@ -51,14 +51,33 @@
int hour = 0,
int minute = 0,
int second = 0,
- int millisecond = 0,
- bool isUtc = false]) {
+ int millisecond = 0]) {
return new DateImplementation(year, month, day,
hour, minute, second,
- millisecond, isUtc);
+ millisecond, false);
}
/**
+ * Constructs a [Date] instance based on the individual parts. The date is
+ * in the UTC time zone.
+ *
+ * [month] and [day] are one-based. For example
+ * [:new Date.utc(1938, 1, 10):] represents the 10th of January 1938 in
+ * Coordinated Universal Time.
+ */
+ factory Date.utc(int year,
+ [int month = 1,
+ int day = 1,
+ int hour = 0,
+ int minute = 0,
+ int second = 0,
+ int millisecond = 0]) {
+ return new DateImplementation(year, month, day,
+ hour, minute, second,
+ millisecond, true);
+ }
+
+ /**
* Constructs a new [Date] instance with current date time value in the
* local time zone.
*/
@@ -82,7 +101,7 @@
// tools don't yet. Eventually we want to have default values here.
// TODO(lrn): Have two constructors instead of taking an optional bool.
factory Date.fromMillisecondsSinceEpoch(int millisecondsSinceEpoch,
- [bool isUtc = false]) {
+ {bool isUtc: false}) {
return new DateImplementation.fromMillisecondsSinceEpoch(
millisecondsSinceEpoch, isUtc);
}
@@ -120,14 +139,16 @@
/**
* Returns [this] in the local time zone. Returns itself if it is already in
* the local time zone. Otherwise, this method is equivalent to
- * [:new Date.fromMillisecondsSinceEpoch(millisecondsSinceEpoch, false):].
+ * [:new Date.fromMillisecondsSinceEpoch(millisecondsSinceEpoch,
+ * isUtc: false):].
*/
Date toLocal();
/**
* Returns [this] in UTC. Returns itself if it is already in UTC. Otherwise,
* this method is equivalent to
- * [:new Date.fromMillisecondsSinceEpoch(millisecondsSinceEpoch, true):].
+ * [:new Date.fromMillisecondsSinceEpoch(millisecondsSinceEpoch,
+ * isUtc: true):].
*/
Date toUtc();
« no previous file with comments | « lib/compiler/samples/leap/leap_leg.dart ('k') | lib/coreimpl/date.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698