1
0
Fork 0
mirror of synced 2024-08-03 20:42:09 +12:00
appwrite/public/scripts/services/date.js

21 lines
470 B
JavaScript
Raw Normal View History

2019-05-09 18:54:39 +12:00
(function (window) {
"use strict";
2019-05-09 20:01:51 +12:00
window.ls.container.set('date', function () {
2022-08-10 02:05:34 +12:00
function format(format, datetime) {
if (!datetime) {
return null;
2019-05-09 18:54:39 +12:00
}
return new Intl.DateTimeFormat(navigator.languages, {
2022-08-10 02:05:34 +12:00
hourCycle: 'h24',
...format
}).format(new Date(datetime));
2019-05-09 18:54:39 +12:00
}
return {
format: format,
}
}(), true);
})(window);