Skip to content

Commit

Permalink
Merge pull request #25772 from waterim/fix-25737-unread-messages
Browse files Browse the repository at this point in the history
[CP Staging] Unread messages fix: change from Etc/UTC to UTC
  • Loading branch information
mountiny authored Aug 23, 2023
2 parents 867d61e + 9dbff2d commit 4b345be
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/libs/DateUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ function getDBTime(timestamp = '') {
* @returns {String}
*/
function subtractMillisecondsFromDateTime(dateTime, milliseconds) {
const date = zonedTimeToUtc(dateTime, 'Etc/UTC');
const date = zonedTimeToUtc(dateTime, 'UTC');
const newTimestamp = subMilliseconds(date, milliseconds).valueOf();
return getDBTime(newTimestamp);
}
Expand Down
10 changes: 5 additions & 5 deletions tests/unit/DateUtilsTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('DateUtils', () => {
keys: ONYXKEYS,
initialKeyStates: {
[ONYXKEYS.SESSION]: {accountID: 999},
[ONYXKEYS.PERSONAL_DETAILS_LIST]: {999: {timezone: {selected: 'Etc/UTC'}}},
[ONYXKEYS.PERSONAL_DETAILS_LIST]: {999: {timezone: {selected: 'UTC'}}},
},
});
return waitForPromisesToResolve();
Expand Down Expand Up @@ -73,7 +73,7 @@ describe('DateUtils', () => {
Intl.DateTimeFormat = jest.fn(() => ({
resolvedOptions: () => ({timeZone: 'America/Chicago'}),
}));
Onyx.set(ONYXKEYS.PERSONAL_DETAILS_LIST, {999: {timezone: {selected: 'Etc/UTC', automatic: true}}}).then(() => {
Onyx.set(ONYXKEYS.PERSONAL_DETAILS_LIST, {999: {timezone: {selected: 'UTC', automatic: true}}}).then(() => {
const result = DateUtils.getCurrentTimezone();
expect(result).toEqual({
selected: 'America/Chicago',
Expand All @@ -84,12 +84,12 @@ describe('DateUtils', () => {

it('should not update timezone if automatic and selected timezone match', () => {
Intl.DateTimeFormat = jest.fn(() => ({
resolvedOptions: () => ({timeZone: 'Etc/UTC'}),
resolvedOptions: () => ({timeZone: 'UTC'}),
}));
Onyx.set(ONYXKEYS.PERSONAL_DETAILS_LIST, {999: {timezone: {selected: 'Etc/UTC', automatic: true}}}).then(() => {
Onyx.set(ONYXKEYS.PERSONAL_DETAILS_LIST, {999: {timezone: {selected: 'UTC', automatic: true}}}).then(() => {
const result = DateUtils.getCurrentTimezone();
expect(result).toEqual({
selected: 'Etc/UTC',
selected: 'UTC',
automatic: true,
});
});
Expand Down

0 comments on commit 4b345be

Please sign in to comment.