From 74cb8a96493ec62aff3d0efcaf28675ad78f9e19 Mon Sep 17 00:00:00 2001 From: Matt Isenhower Date: Tue, 5 Dec 2017 09:06:38 -0800 Subject: [PATCH] Use the selected locale for date/time formats --- src/js/filters.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/js/filters.js b/src/js/filters.js index 9907b07..cb3e11a 100644 --- a/src/js/filters.js +++ b/src/js/filters.js @@ -1,5 +1,6 @@ import Vue from 'vue'; const $t = Vue.i18n.translate; +const currentLocale = Vue.i18n.locale; // Local hosting of SplatNet images Vue.filter('localSplatNetImageUrl', function(value) { @@ -10,12 +11,12 @@ Vue.filter('localSplatNetImageUrl', function(value) { // Short date format (e.g., 8/15 or 15/8) Vue.filter('date', function(value, options = undefined) { - return (new Date(value * 1000)).toLocaleDateString([], Object.assign({ month: 'numeric', day: 'numeric' }, options)); + return (new Date(value * 1000)).toLocaleDateString([currentLocale()], Object.assign({ month: 'numeric', day: 'numeric' }, options)); }); // Short localized time format (e.g., 1:23 PM or 13:23) Vue.filter('time', function(value) { - return (new Date(value * 1000)).toLocaleTimeString([], { hour: 'numeric', minute: '2-digit' }); + return (new Date(value * 1000)).toLocaleTimeString([currentLocale()], { hour: 'numeric', minute: '2-digit' }); }); function getDurationParts(value) {