Skip to content

Commit

Permalink
Desktop: Apply current locale to date and time (laurent22#1822)
Browse files Browse the repository at this point in the history
  • Loading branch information
CalebJohn authored and scoroi committed Nov 10, 2019
1 parent bc1c157 commit c7a9aad
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ReactNativeClient/lib/BaseApplication.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}
Expand Down
10 changes: 10 additions & 0 deletions ReactNativeClient/lib/time-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit c7a9aad

Please sign in to comment.