Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Unified Diff: src/date.js

Issue 1203733002: Avoid built-ins in `Date.prototype.toISOString` (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/date.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/date.js
diff --git a/src/date.js b/src/date.js
index dbf494788413f60cb4c321b57c6c6672d3e3ea49..46fadecaf202d0f3655d66d48c46dbe398ad1f49 100644
--- a/src/date.js
+++ b/src/date.js
@@ -747,12 +747,12 @@ function PadInt(n, digits) {
}
-// ECMA 262 - 15.9.5.43
+// ECMA 262 - 20.3.4.36
function DateToISOString() {
CHECK_DATE(this);
var t = UTC_DATE_VALUE(this);
if (NUMBER_IS_NAN(t)) throw MakeRangeError(kInvalidTimeValue);
- var year = this.getUTCFullYear();
+ var year = UTC_YEAR(this);
var year_string;
if (year >= 0 && year <= 9999) {
year_string = PadInt(year, 4);
@@ -764,12 +764,12 @@ function DateToISOString() {
}
}
return year_string +
- '-' + PadInt(this.getUTCMonth() + 1, 2) +
- '-' + PadInt(this.getUTCDate(), 2) +
- 'T' + PadInt(this.getUTCHours(), 2) +
- ':' + PadInt(this.getUTCMinutes(), 2) +
- ':' + PadInt(this.getUTCSeconds(), 2) +
- '.' + PadInt(this.getUTCMilliseconds(), 3) +
+ '-' + PadInt(UTC_MONTH(this) + 1, 2) +
+ '-' + PadInt(UTC_DAY(this), 2) +
+ 'T' + PadInt(UTC_HOUR(this), 2) +
+ ':' + PadInt(UTC_MIN(this), 2) +
+ ':' + PadInt(UTC_SEC(this), 2) +
+ '.' + PadInt(UTC_MS(this), 3) +
'Z';
}
« no previous file with comments | « no previous file | test/mjsunit/date.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698