diff --git a/src/datetime.test.js b/src/datetime.test.js index 8e33489..ab368ae 100644 --- a/src/datetime.test.js +++ b/src/datetime.test.js @@ -1,7 +1,7 @@ import { describe, expect, test } from 'vitest' import { datetime, datetimeTz, tzOffset, utc } from './index.js' -import { getNormalizeDay } from './utils/date.js' +import { getNormalizedDay } from './utils/date.js' const togoIndependanceDay = new Date(1960, 3, 27) const date = togoIndependanceDay // alias for the sake of brevity @@ -90,7 +90,7 @@ describe('datetime', () => { // 1st day of the year is after Thurdsay test('week on 2021-01-01 is 2020-W53', () => { - expect(getNormalizeDay(january1st2021)).toBeGreaterThan(4) + expect(getNormalizedDay(january1st2021)).toBeGreaterThan(4) expect(datetime(january1st2021, 'week')).toBe('2020-W53') }) @@ -109,7 +109,7 @@ describe('datetime', () => { // 1st day of the month is after Thurdsay, but it’s not in January test('week on 2021-03-01 is 2021-W17', () => { const march1st2021 = new Date(2021, 4, 1) - expect(getNormalizeDay(march1st2021)).toBeGreaterThan(4) + expect(getNormalizedDay(march1st2021)).toBeGreaterThan(4) expect(datetime(march1st2021, 'week')).toBe('2021-W17') }) diff --git a/src/utils/date.js b/src/utils/date.js index ec38e03..a4c5023 100644 --- a/src/utils/date.js +++ b/src/utils/date.js @@ -35,7 +35,7 @@ export function daysBetween(date, furtherDate) { * @returns {number} */ export function weekNumber(date) { - const dayIndex = getNormalizeDay(date) + const dayIndex = getNormalizedDay(date) const sameWeekThursday = new Date(date) sameWeekThursday.setDate(date.getDate() + 4 - dayIndex) @@ -52,4 +52,4 @@ export function weekNumber(date) { * @param {Date} date * @returns {number} */ -export const getNormalizeDay = date => date.getDay() || 7 +export const getNormalizedDay = date => date.getDay() || 7 diff --git a/types/utils/date.d.ts b/types/utils/date.d.ts index 9ffc910..5bf0563 100644 --- a/types/utils/date.d.ts +++ b/types/utils/date.d.ts @@ -18,3 +18,4 @@ export function daysBetween(date: Date, furtherDate: Date): number; * @returns {number} */ export function weekNumber(date: Date): number; +export function getNormalizedDay(date: Date): number;