Skip to content

mapDaysInMonth

mapDaysInMonth(month: string): string[]
import { mapDaysInMonth } from "@northguild/gmt/plain/map";

Return an array of ISO PlainDate strings for every day in the given year-month.

  • Generates array of dates for the specified month.
  • Validates input matches the year-month format exactly.
  • Returns [] for invalid input.
Parameter Type Description
month string ISO PlainYearMonth string (YYYY-MM)

array of ISO PlainDate strings for each day in the month

mapDaysInMonth("2024-02") // ["2024-02-01", "2024-02-02", ..., "2024-02-29"]
mapDaysInMonth("2024-04") // ["2024-04-01", "2024-04-02", ..., "2024-04-30"]
mapDaysInMonth("invalid") // []

plain/map/mapDaysInMonth.ts