Implement date.prototype.toISOString() and date.prototype.toUTCString()

JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs.u-szeged@partner.samsung.com
This commit is contained in:
Roland Takacs
2015-07-20 13:16:32 +02:00
committed by Evgeny Gavrin
parent d11dfc5703
commit 63083b3b51
5 changed files with 182 additions and 111 deletions
+30
View File
@@ -58,3 +58,33 @@ catch (e)
assert (e instanceof TypeError);
assert (e.message === "Incompatible type");
}
assert (new Date (NaN).toISOString () == "Invalid Date");
assert (new Date ("2015-07-16").toISOString () == "2015-07-16T00:00:00.000Z");
assert (new Date ("2015-07-16T11:29:05.023").toISOString () == "2015-07-16T11:29:05.023Z");
try
{
Date.prototype.toISOString.call(-1);
assert (false);
}
catch (e)
{
assert (e instanceof TypeError);
assert (e.message === "Incompatible type");
}
assert (new Date (NaN).toUTCString () == "Invalid Date");
assert (new Date ("2015-07-16").toUTCString () == "2015-07-16T00:00:00.000Z");
assert (new Date ("2015-07-16T11:29:05.023").toUTCString () == "2015-07-16T11:29:05.023Z");
try
{
Date.prototype.toUTCString.call(-1);
assert (false);
}
catch (e)
{
assert (e instanceof TypeError);
assert (e.message === "Incompatible type");
}