Skip to content

Commit 66f613f

Browse files
committed
fix toIsoString on date
1 parent 63395da commit 66f613f

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

core/lib_polyfill.ssjs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -621,16 +621,15 @@ if (!Array.prototype.map) {
621621
============================================================================ */
622622

623623
if (!Date.prototype.toISOString) {
624-
(function() {
624+
Date.prototype.toISOString = function() {
625625

626-
function pad(number) {
627-
if (number < 10) {
628-
return '0' + number;
626+
var pad = function(number) {
627+
if (number < 10) {
628+
return '0' + number;
629+
}
630+
return number;
629631
}
630-
return number;
631-
}
632632

633-
Date.prototype.toISOString = function() {
634633
return this.getUTCFullYear() +
635634
'-' + pad(this.getUTCMonth() + 1) +
636635
'-' + pad(this.getUTCDate()) +
@@ -639,7 +638,5 @@ if (!Date.prototype.toISOString) {
639638
':' + pad(this.getUTCSeconds()) +
640639
'.' + (this.getUTCMilliseconds() / 1000).toFixed(3).slice(2, 5) +
641640
'Z';
642-
};
643-
644-
})();
641+
}
645642
}

0 commit comments

Comments
 (0)