From 9dbff2d533ba3486a49b12453a4953ebf3c1a864 Mon Sep 17 00:00:00 2001 From: Artem Makushov Date: Wed, 23 Aug 2023 16:16:06 +0200 Subject: [PATCH] change from Etc/UTC to UTC --- src/libs/DateUtils.js | 2 +- tests/unit/DateUtilsTest.js | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/libs/DateUtils.js b/src/libs/DateUtils.js index 0767bc44c002..b33a1b1b2a73 100644 --- a/src/libs/DateUtils.js +++ b/src/libs/DateUtils.js @@ -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); } diff --git a/tests/unit/DateUtilsTest.js b/tests/unit/DateUtilsTest.js index 305ffdb8f487..d17c1c052929 100644 --- a/tests/unit/DateUtilsTest.js +++ b/tests/unit/DateUtilsTest.js @@ -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(); @@ -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', @@ -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, }); });