Commit 552e5f83 authored by ager@chromium.org's avatar ager@chromium.org

Make Date.prototype.toTimeString and Date.prototype.toLocaleTimeString

only return the time portion of the date.


git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@128 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 1827c2b1
......@@ -614,6 +614,15 @@ function DateToTimeString() {
};
// ECMA 262 - 15.9.5.7
function DateToLocaleTimeString() {
var t = GetTimeFrom(this);
if ($isNaN(t)) return kInvalidDate;
var lt = LocalTime(t);
return TimeString(lt);
};
// ECMA 262 - 15.9.5.9
function DateGetTime() {
return GetTimeFrom(this);
......@@ -939,7 +948,7 @@ function SetupDate() {
toTimeString: DateToTimeString,
toLocaleString: DateToString,
toLocaleDateString: DateToDateString,
toLocaleTimeString: DateToTimeString,
toLocaleTimeString: DateToLocaleTimeString,
valueOf: DateGetTime,
getTime: DateGetTime,
getFullYear: DateGetFullYear,
......
......@@ -124,3 +124,12 @@ l.setUTCMilliseconds();
l.setUTCMilliseconds(2);
assertTrue(isNaN(l.getUTCMilliseconds()));
// Test that toLocaleTimeString only returns the time portion of the
// date without the timezone information.
function testToLocaleTimeString() {
var d = new Date();
var s = d.toLocaleTimeString();
assertEquals(8, s.length);
}
testToLocaleTimeString();
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