| Index: src/date.js
|
| diff --git a/src/date.js b/src/date.js
|
| index 5a2e9a2343f0b911518f3a44ccd10ebc8079c54b..79b846d4a7060efc938990330cf8396b07224073 100644
|
| --- a/src/date.js
|
| +++ b/src/date.js
|
| @@ -981,11 +981,22 @@ function PadInt(n, digits) {
|
| function DateToISOString() {
|
| var t = DATE_VALUE(this);
|
| if (NUMBER_IS_NAN(t)) return kInvalidDate;
|
| - return this.getUTCFullYear() +
|
| + var year = this.getUTCFullYear();
|
| + var year_string;
|
| + if (year >= 0 && year <= 9999) {
|
| + year_string = PadInt(year, 4);
|
| + } else {
|
| + if (year < 0) {
|
| + year_string = "-" + PadInt(-year, 6);
|
| + } else {
|
| + year_string = "+" + PadInt(year, 6);
|
| + }
|
| + }
|
| + return year_string +
|
| '-' + PadInt(this.getUTCMonth() + 1, 2) +
|
| - '-' + PadInt(this.getUTCDate(), 2) +
|
| + '-' + PadInt(this.getUTCDate(), 2) +
|
| 'T' + PadInt(this.getUTCHours(), 2) +
|
| - ':' + PadInt(this.getUTCMinutes(), 2) +
|
| + ':' + PadInt(this.getUTCMinutes(), 2) +
|
| ':' + PadInt(this.getUTCSeconds(), 2) +
|
| '.' + PadInt(this.getUTCMilliseconds(), 3) +
|
| 'Z';
|
| @@ -995,8 +1006,8 @@ function DateToISOString() {
|
| function DateToJSON(key) {
|
| var o = ToObject(this);
|
| var tv = DefaultNumber(o);
|
| - if (IS_NUMBER(tv) && !NUMBER_IS_FINITE(tv)) {
|
| - return null;
|
| + if (IS_NUMBER(tv) && !NUMBER_IS_FINITE(tv)) {
|
| + return null;
|
| }
|
| return o.toISOString();
|
| }
|
|
|