Commit 24cb757a authored by feng@chromium.org's avatar feng@chromium.org

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
parent 156c1323
......@@ -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));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment