diff --git a/src/ONYXKEYS.js b/src/ONYXKEYS.js index 8cbf4a726f95..86d8b831dd38 100755 --- a/src/ONYXKEYS.js +++ b/src/ONYXKEYS.js @@ -45,6 +45,9 @@ export default { // Contains all the personalDetails the user has access to PERSONAL_DETAILS: 'personalDetails', + // Contains all the personalDetails the user has access to [new version] + PERSONAL_DETAILS_LIST: 'personalDetailsList', + // Contains all the private personal details of the user PRIVATE_PERSONAL_DETAILS: 'private_personalDetails', diff --git a/src/libs/DateUtils.js b/src/libs/DateUtils.js index 7196a8f0a89e..8a11d6dd58b9 100644 --- a/src/libs/DateUtils.js +++ b/src/libs/DateUtils.js @@ -11,7 +11,7 @@ import CONST from '../CONST'; import * as Localize from './Localize'; import * as CurrentDate from './actions/CurrentDate'; -let currentUserEmail; +let currentAccountID; Onyx.connect({ key: ONYXKEYS.SESSION, callback: (val) => { @@ -20,15 +20,15 @@ Onyx.connect({ return; } - currentUserEmail = val.email; + currentAccountID = val.accountID; }, }); let timezone = CONST.DEFAULT_TIME_ZONE; Onyx.connect({ - key: ONYXKEYS.PERSONAL_DETAILS, + key: ONYXKEYS.PERSONAL_DETAILS_LIST, callback: (val) => { - timezone = lodashGet(val, [currentUserEmail, 'timezone'], CONST.DEFAULT_TIME_ZONE); + timezone = lodashGet(val, [currentAccountID, 'timezone'], CONST.DEFAULT_TIME_ZONE); }, }); diff --git a/tests/unit/DateUtilsTest.js b/tests/unit/DateUtilsTest.js index cb1e8d839fa1..da2c9456e205 100644 --- a/tests/unit/DateUtilsTest.js +++ b/tests/unit/DateUtilsTest.js @@ -12,8 +12,8 @@ describe('DateUtils', () => { Onyx.init({ keys: ONYXKEYS, initialKeyStates: { - [ONYXKEYS.SESSION]: {email: 'current@user.com'}, - [ONYXKEYS.PERSONAL_DETAILS]: {'current@user.com': {timezone: {selected: 'Etc/UTC'}}}, + [ONYXKEYS.SESSION]: {accountID: 999}, + [ONYXKEYS.PERSONAL_DETAILS_LIST]: {999: {timezone: {selected: 'Etc/UTC'}}}, }, }); return waitForPromisesToResolve();