mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Change Intl.DateTimeFormat() into toLocaleString() for iOS < 14
This commit is contained in:
parent
508c262a4b
commit
a83cb9150e
2 changed files with 3 additions and 8 deletions
|
|
@ -135,7 +135,7 @@ export const
|
||||||
timeToNode = (element, time) => {
|
timeToNode = (element, time) => {
|
||||||
try {
|
try {
|
||||||
if (time) {
|
if (time) {
|
||||||
element.dateTime = (new Date(time * 1000)).format('ISO8601');
|
element.dateTime = new Date(time * 1000).toISOString();
|
||||||
} else {
|
} else {
|
||||||
time = Date.parse(element.dateTime) / 1000;
|
time = Date.parse(element.dateTime) / 1000;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
9
dev/prototype.js
vendored
9
dev/prototype.js
vendored
|
|
@ -12,17 +12,12 @@
|
||||||
let formats = {
|
let formats = {
|
||||||
LT : {timeStyle: 'short'},
|
LT : {timeStyle: 'short'},
|
||||||
LLL : {dateStyle: 'long', timeStyle: 'short'}
|
LLL : {dateStyle: 'long', timeStyle: 'short'}
|
||||||
},
|
};
|
||||||
pad2 = v => 10 > v ? '0' + v : v;
|
|
||||||
|
|
||||||
// Format momentjs/PHP date formats to Intl.DateTimeFormat
|
// Format momentjs/PHP date formats to Intl.DateTimeFormat
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat
|
||||||
Date.prototype.format = function (options, UTC, hourCycle) {
|
Date.prototype.format = function (options, UTC, hourCycle) {
|
||||||
if (typeof options == 'string') {
|
if (typeof options == 'string') {
|
||||||
if ('ISO8601' == options) {
|
|
||||||
return this.getFullYear() + '-' + pad2(1 + this.getMonth()) + '-' + pad2(this.getDate())
|
|
||||||
+ 'T' + pad2(this.getHours()) + ':' + pad2(this.getMinutes()) + ':' + pad2(this.getSeconds());
|
|
||||||
}
|
|
||||||
if (formats[options]) {
|
if (formats[options]) {
|
||||||
options = formats[options];
|
options = formats[options];
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -33,7 +28,7 @@
|
||||||
if (hourCycle) {
|
if (hourCycle) {
|
||||||
options.hourCycle = hourCycle;
|
options.hourCycle = hourCycle;
|
||||||
}
|
}
|
||||||
return new Intl.DateTimeFormat(doc.documentElement.lang, options).format(this);
|
return this.toLocaleString(doc.documentElement.lang, options);
|
||||||
};
|
};
|
||||||
|
|
||||||
Element.prototype.closestWithin = function(selector, parent) {
|
Element.prototype.closestWithin = function(selector, parent) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue