Skip to content

Instantly share code, notes, and snippets.

@filip1
Forked from kekscom/gist:5053306
Last active May 26, 2022 08:06
Show Gist options
  • Save filip1/7bcff67d8d8ad878378e5e41acd851f4 to your computer and use it in GitHub Desktop.
Save filip1/7bcff67d8d8ad878378e5e41acd851f4 to your computer and use it in GitHub Desktop.
JavaScript Date.toLocalISOString() method
Date.prototype.toLocalISOString = function() {
var off = this.getTimezoneOffset();
return new Date(this.getFullYear(), this.getMonth(), this.getDate(), this.getHours(), this.getMinutes() - off, this.getSeconds(), this.getMilliseconds()).toISOString().slice(0,-1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment