Skip to content
ts
import { getWeekNumber } from '@trail-run/core/time/helpers';

Function: getWeekNumber()

ts
function getWeekNumber(date, day): number;

Defined in: src/time/helpers.ts:55

Get the week number for a given date (Monday as first day) January 1st is always in week 1 (which may be a partial week). The first Monday starts week 2, unless January 1st is a Monday.

Parameters

date

Date

day

"monday" | "sunday"

Returns

number

Released under the MIT License.