Skip to content

getDayOfYear

getDayOfYear(value: string): number | null

Return the ordinal day-of-year (1-based) for value.

  • Jan 1 is 1; Dec 31 is 365 (common year) or 366 (leap year).
  • Returns null on invalid input.
ParameterTypeDescription
valuestringISO PlainDate string

1-366, or null on invalid input

import { getDayOfYear } from "@northguild/gmt/plain/calculate";
getDayOfYear("2024-01-01") // 1
output 

plain/calculate/getDayOfYear.ts