diff options
author | Sukanya Pandey <sukapan1@in.ibm.com> | 2020-06-23 20:24:27 +0300 |
---|---|---|
committer | Derick Montague <derick.montague@ibm.com> | 2020-07-28 00:35:55 +0300 |
commit | fc16f3c268a9d35f889f5770331d11e87ab16af3 (patch) | |
tree | 447e8f3b8b1eba2767e05ab016a46fd540e3a230 /src/store | |
parent | a2c99829a713e8411bda20091765ee972cd4d8b9 (diff) | |
download | webui-vue-fc16f3c268a9d35f889f5770331d11e87ab16af3.tar.xz |
Add timezone to profile settings page
- Users will have two options to select a timezone.
- UTC and browser offset timezone are the two options for the application.
- date-fns and date-fns-tz is used for date and time manipulations because:-
- The package size of library is smaller.
- It allows for importing functions to work with the native date object
rather than having to create a moment instance that carries a larger payload.
Signed-off-by: Sukanya Pandey <sukapan1@in.ibm.com>
Change-Id: I581803f230f501c0d34d0b53e7c2d89e8466ee60
Diffstat (limited to 'src/store')
-rw-r--r-- | src/store/modules/GlobalStore.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/store/modules/GlobalStore.js b/src/store/modules/GlobalStore.js index 55b07965..39f3d1d4 100644 --- a/src/store/modules/GlobalStore.js +++ b/src/store/modules/GlobalStore.js @@ -32,12 +32,16 @@ const GlobalStore = { bmcTime: null, hostStatus: 'unreachable', languagePreference: localStorage.getItem('storedLanguage') || 'en-US', + isUtcDisplay: localStorage.getItem('storedUtcDisplay') + ? JSON.parse(localStorage.getItem('storedUtcDisplay')) + : true, username: localStorage.getItem('storedUsername') }, getters: { hostStatus: state => state.hostStatus, bmcTime: state => state.bmcTime, languagePreference: state => state.languagePreference, + isUtcDisplay: state => state.isUtcDisplay, username: state => state.username }, mutations: { @@ -46,7 +50,8 @@ const GlobalStore = { (state.hostStatus = hostStateMapper(hostState)), setLanguagePreference: (state, language) => (state.languagePreference = language), - setUsername: (state, username) => (state.username = username) + setUsername: (state, username) => (state.username = username), + setUtcTime: (state, isUtcDisplay) => (state.isUtcDisplay = isUtcDisplay) }, actions: { async getBmcTime({ commit }) { |