Fix Chromium issue 3607.

Make Date::toLocaleDateString output be the same format as Safari.

Someone famililar with Date builtin object should check other functions.


Review URL: http://codereview.chromium.org/8875

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@645 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
feng@chromium.org 2008-10-29 23:30:25 +00:00
parent 156c1323e3
commit 24cb757ae3

View File

@ -517,6 +517,19 @@ function DateString(time) {
}
var LongWeekDays = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
var LongMonths = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
function LongDateString(time) {
var YMD = FromJulianDay(Day(time) + kDayZeroInJulianDay);
return LongWeekDays[WeekDay(time)] + ', '
+ LongMonths[YMD.month] + ' '
+ TwoDigitString(YMD.date) + ', '
+ YMD.year;
}
function TimeString(time) {
return TwoDigitString(HourFromTime(time)) + ':'
+ TwoDigitString(MinFromTime(time)) + ':'
@ -616,7 +629,9 @@ function DateToLocaleString() {
// ECMA 262 - 15.9.5.6
function DateToLocaleDateString() {
return DateToDateString.call(this);
var t = GetTimeFrom(this);
if ($isNaN(t)) return kInvalidDate;
return LongDateString(LocalTimeNoCheck(t));
}