diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2019-09-04 16:09:35 +0200 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2019-09-04 16:09:35 +0200 |
commit | 9e68367d03bc4ff789b77c897a35c9b031406613 (patch) | |
tree | 8e9d3a829e1292671924c9e9a043f169c0ab5e5b /src/components | |
parent | d0b5da84863fa31a071f4d299b7b8a54965a4ad1 (diff) |
Fix moment loading
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/Properties/PropertyDateTime.vue | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/components/Properties/PropertyDateTime.vue b/src/components/Properties/PropertyDateTime.vue index 83b1a314..f93d1092 100644 --- a/src/components/Properties/PropertyDateTime.vue +++ b/src/components/Properties/PropertyDateTime.vue @@ -136,22 +136,26 @@ export default { let locale = getLocale().replace('_', '-').toLowerCase() // default load e.g. fr-fr - import('moment/locale/' + this.locale) + console.debug('Importing locale', locale) + import('moment/locale/' + locale) .then(e => { // force locale change to update // the component once done loading this.locale = locale }) .catch(e => { - // failure: fallback to fr - import('moment/locale/' + locale.split('-')[0]) - .then(e => { - this.locale = locale.split('-')[0] - }) - .catch(e => { - // failure, fallback to english - this.locale = 'en' - }) + // failure: fallback to fr + locale = locale.split('-')[0] + console.debug('Fallback to locale', locale) + import('moment/locale/' + locale) + .then(e => { + this.locale = locale + }) + .catch(e => { + console.debug('Fallback to locale', 'en') + // failure, fallback to english + this.locale = 'en' + }) }) }, |