From c7a9aad748538825f7e8dac4c8e3803725168995 Mon Sep 17 00:00:00 2001 From: Caleb John Date: Thu, 29 Aug 2019 10:38:24 -0600 Subject: [PATCH] Desktop: Apply current locale to date and time (#1822) --- ReactNativeClient/lib/BaseApplication.js | 3 ++- ReactNativeClient/lib/time-utils.js | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ReactNativeClient/lib/BaseApplication.js b/ReactNativeClient/lib/BaseApplication.js index d5de6967253..1c3731c73d2 100644 --- a/ReactNativeClient/lib/BaseApplication.js +++ b/ReactNativeClient/lib/BaseApplication.js @@ -391,7 +391,8 @@ class BaseApplication { // }); // } - if ((action.type == 'SETTING_UPDATE_ONE' && (action.key == 'dateFormat' || action.key == 'timeFormat')) || action.type == 'SETTING_UPDATE_ALL') { + if ((action.type == 'SETTING_UPDATE_ONE' && (action.key == 'dateFormat' || action.key == 'timeFormat' || action.key == 'locale')) || action.type == 'SETTING_UPDATE_ALL') { + time.setLocale(Setting.value('locale')); time.setDateFormat(Setting.value('dateFormat')); time.setTimeFormat(Setting.value('timeFormat')); } diff --git a/ReactNativeClient/lib/time-utils.js b/ReactNativeClient/lib/time-utils.js index ee13a55a31f..3613bde056c 100644 --- a/ReactNativeClient/lib/time-utils.js +++ b/ReactNativeClient/lib/time-utils.js @@ -4,6 +4,16 @@ class Time { constructor() { this.dateFormat_ = 'DD/MM/YYYY'; this.timeFormat_ = 'HH:mm'; + this.locale_ = 'en-us'; + } + + locale() { + return this.locale_; + } + + setLocale(v) { + moment.locale(v); + this.locale_ = v } dateFormat() {