Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use accountID in DateUtils #20037

Merged
merged 3 commits into from
Jun 5, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/ONYXKEYS.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',

Expand Down
8 changes: 4 additions & 4 deletions src/libs/DateUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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);
},
});

Expand Down