JSFiddle - React, Tailwind, and code Playground
by alnitak
JavaScript
Date.prototype.ISO8601date = function() {
function fix2(n) {
return (n < 10) ? '0' + n : n;
}
return this.getFullYear() + '-' + fix2(this.getMonth() + 1) + '-' + fix2(this.getDate());
}
var d = new Date();
var s = d.ISO8601date();
alert(s);