Skip to content

getWeekOfYear

The getWeekOfYear() function calculates the ISO 8601 week number (1–53) for a TheDate, with an optional timezone.

Interactive example

Syntax

typescript
function getWeekOfYear<
	GenericInput extends TheDate
>(
	input: GenericInput,
	timezone?: Timezone
): number

Parameters

  • input: Target TheDate.
  • timezone: (Optional) IANA timezone.

Return value

An integer between 1 and 53 corresponding to the ISO week.

See also

Sources

Released under the MIT license.