Replace moment.js with smaller day.js

This commit is contained in:
Wruczek
2020-10-21 16:18:00 +02:00
parent f3d7584a46
commit 2ca6ac03d7
3 changed files with 16 additions and 13 deletions
+6 -4
View File
@@ -15,7 +15,10 @@ $(function () {
// END string.format
// START Time functions
console.log("Moment.js locale set to " + moment.locale());
dayjs.extend(window.dayjs_plugin_localizedFormat)
dayjs.extend(window.dayjs_plugin_relativeTime)
console.log("Day.js locale set to " + dayjs.locale());
updateRelativeTime();
@@ -107,9 +110,8 @@ $(function () {
function timestampToDate(timestamp, full) {
"use strict"
var ld = moment.localeData()
var fuzzydate = moment.unix(timestamp).fromNow()
var fulldate = moment.unix(timestamp).format(ld.longDateFormat("LLL"))
var fuzzydate = dayjs.unix(timestamp).fromNow()
var fulldate = dayjs.unix(timestamp).format("LLL")
return full ? fulldate : fuzzydate
}