Fixed setting moment.js locale to user-defined language

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
Erik Michelson 2020-08-13 15:08:27 +02:00
parent e79b7e962d
commit ce469b1e2d
No known key found for this signature in database
GPG key ID: DB99ADDDC5C0AF82
2 changed files with 7 additions and 1 deletions

View file

@ -1,6 +1,6 @@
/* eslint-env browser, jquery */
/* eslint no-console: ["error", { allow: ["warn", "error"] }] */
/* global moment, serverurl */
/* global moment, serverurl, Cookies */
import Prism from 'prismjs'
import hljs from 'highlight.js'
@ -31,6 +31,11 @@ require('../vendor/md-toc')
var Viz = require('viz.js')
const ui = getUIElements()
if (Cookies.get('locale')) {
const lang = Cookies.get('locale')
moment.locale(lang)
}
// auto update last change
window.createtime = null
window.lastchangetime = null

View file

@ -21,6 +21,7 @@ if (Cookies.get('locale')) {
}
locale.val(lang)
window.moment.locale(lang)
$('select.ui-locale option[value="' + lang + '"]').attr('selected', 'selected')
locale.change(function () {