Remove deprecated classes and functions in Date.

Review URL: https://chromiumcodereview.appspot.com//10541050

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8445 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
floitsch@google.com
2012-06-08 16:01:00 +00:00
parent 6c9c84dc6e
commit 2c2ee2000f
9 changed files with 3 additions and 109 deletions
-1
View File
@@ -31,6 +31,5 @@
'string.dart',
'strings.dart',
'string_buffer.dart',
'time_zone.dart',
],
}
-26
View File
@@ -47,21 +47,6 @@ interface Date extends Comparable, Hashable default DateImplementation {
int milliseconds,
bool isUtc]);
/**
* Constructs a [Date] instance based on the individual parts.
* [timeZone] may not be [:null:].
*
* *DEPRECATED*
*/
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 in the
* local time zone.
@@ -128,17 +113,6 @@ interface Date extends Comparable, Hashable default DateImplementation {
*/
Date toUtc();
/**
* 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):].
*
* *DEPRECATED*
*/
Date changeTimeZone(TimeZone targetTimeZone);
/**
* Returns the abbreviated time-zone name.
*
-16
View File
@@ -1,16 +0,0 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Dart core library.
/**
* [TimeZone]s represent locations (for example Europe/Paris).
*
* *DEPRECATED*
*/
interface TimeZone default TimeZoneImplementation {
const TimeZone.utc();
TimeZone.local();
bool get isUtc();
}
@@ -35,7 +35,6 @@
#source('../../../../corelib/src/string.dart');
#source('../../../../corelib/src/string_buffer.dart');
#source('../../../../corelib/src/strings.dart');
#source('../../../../corelib/src/time_zone.dart');
#source('mock.dart');
#source('clock.dart');
@@ -166,18 +166,6 @@ 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;
@@ -196,17 +184,6 @@ 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() {
@@ -296,13 +273,6 @@ 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);
@@ -76,7 +76,6 @@ final List<String> argv = const <String>[
'../corelib/src/string.dart',
'../corelib/src/string_buffer.dart',
'../corelib/src/strings.dart',
'../corelib/src/time_zone.dart',
'../lib/json/json.dart',
'../lib/utf/utf.dart',
'../lib/utf/utf_core.dart',
+2 -2
View File
@@ -230,8 +230,8 @@ class DateFormat {
* Format the given [date] object according to preset pattern and current
* locale and return a formated string for the given date.
*/
String format(Date date, [TimeZone timeZone]) {
// TODO(efortuna): optional TimeZone argument? TimeZone is deprecated...
String format(Date date) {
// TODO(efortuna): readd optional TimeZone argument (or similar)?
return date.toString();
}
-30
View File
@@ -3,18 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
// Dart core library.
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;
}
// VM implementation of DateImplementation.
class DateImplementation implements Date {
static final int _SECONDS_YEAR_2035 = 2051222400;
@@ -33,17 +21,6 @@ class DateImplementation implements Date {
if (value === null) throw new IllegalArgumentException();
}
DateImplementation.withTimeZone(int years,
int month,
int day,
int hours,
int minutes,
int seconds,
int milliseconds,
TimeZone timeZone)
: this(years, month, day, hours, minutes, seconds, milliseconds,
timeZone.isUtc);
DateImplementation.now()
: _isUtc = true,
value = _getCurrentMs() {
@@ -131,13 +108,6 @@ 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 _timeZoneName(_equivalentSeconds(_secondsSinceEpoch));
+1 -2
View File
@@ -289,8 +289,7 @@ void testCookie() {
Cookie cookie;
cookie = new Cookie("name", "value");
Expect.equals("name=value", cookie.toString());
TimeZone utc = new TimeZone.utc();
Date date = new Date.withTimeZone(2014, Date.JAN, 5, 23, 59, 59, 0, utc);
Date date = new Date(2014, Date.JAN, 5, 23, 59, 59, 0, isUtc: true);
cookie.expires = date;
checkCookie(cookie, "name=value"
"; Expires=Sun, 5 Jan 2014 23:59:59 GMT");