'Y-m-d\\TH:i:s' as 'ISO8601'

This commit is contained in:
the-djmaze 2022-12-23 16:10:35 +01:00
parent a451600d8b
commit a9b336d90f
2 changed files with 2 additions and 2 deletions

View file

@ -134,7 +134,7 @@ export const
timeToNode = (element, time) => {
try {
if (time) {
element.dateTime = (new Date(time * 1000)).format('Y-m-d\\TH:i:s');
element.dateTime = (new Date(time * 1000)).format('ISO8601');
} else {
time = Date.parse(element.dateTime) / 1000;
}

2
dev/prototype.js vendored
View file

@ -46,7 +46,7 @@
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat
Date.prototype.format = function (options, UTC, hourCycle) {
if (typeof options == 'string') {
if ('Y-m-d\\TH:i:s' == options) {
if ('ISO8601' == options) {
return this.getFullYear() + '-' + pad2(1 + this.getMonth()) + '-' + pad2(this.getDate())
+ 'T' + pad2(this.getHours()) + ':' + pad2(this.getMinutes()) + ':' + pad2(this.getSeconds());
}