Advertisement
Guest User

Untitled

a guest
Feb 27th, 2020
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if (!Date.prototype.toLocalISOString) {
  2.         (function() {
  3.  
  4.             function pad(number) {
  5.                 if (number < 10) {
  6.                     return '0' + number;
  7.                 }
  8.                 return number;
  9.             }
  10.  
  11.             Date.prototype.toLocalISOString = function() {
  12.                 return this.getFullYear() +
  13.                     '-' + pad(this.getMonth() + 1) +
  14.                     '-' + pad(this.getDate()) +
  15.                     'T' + pad(this.getHours()) +
  16.                     ':' + pad(this.getMinutes()) +
  17.                     ':' + pad(this.getSeconds()) +
  18.                     '.' + (this.getMilliseconds() / 1000).toFixed(3).slice(2, 5) +
  19.                     'Z';
  20.             };
  21.  
  22.         }());
  23.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement