From 3e40a53d735f50c9aa3d80c88a74cccd1c425074 Mon Sep 17 00:00:00 2001 From: Pedro Guerreiro Date: Wed, 20 Mar 2024 17:12:59 +0000 Subject: [PATCH] refactor(typescript): apply pull request feedback --- src/libs/DateUtils.ts | 2 +- tests/unit/DateUtilsTest.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/DateUtils.ts b/src/libs/DateUtils.ts index dee66c3993e3..4d4f8d425681 100644 --- a/src/libs/DateUtils.ts +++ b/src/libs/DateUtils.ts @@ -266,7 +266,7 @@ function formatToLongDateWithWeekday(datetime: string | Date): string { * * @returns Sunday */ -function formatToDayOfWeek(datetime: string | Date): string { +function formatToDayOfWeek(datetime: Date): string { return format(new Date(datetime), CONST.DATE.WEEKDAY_TIME_FORMAT); } diff --git a/tests/unit/DateUtilsTest.ts b/tests/unit/DateUtilsTest.ts index 8758050e6f62..a7f43ea84045 100644 --- a/tests/unit/DateUtilsTest.ts +++ b/tests/unit/DateUtilsTest.ts @@ -42,7 +42,7 @@ describe('DateUtils', () => { }); it('formatToDayOfWeek should return a weekday', () => { - const weekDay = DateUtils.formatToDayOfWeek(datetime); + const weekDay = DateUtils.formatToDayOfWeek(new Date(datetime)); expect(weekDay).toBe('Monday'); }); it('formatToLocalTime should return a date in a local format', () => {