Skip to content

getDaysInYearMonth

getDaysInYearMonth(value: string): number | null

Return the number of days in a year-month.

  • 28–31 depending on the month; February varies by leap year.
  • The two limit months, -271821-04 and +275760-09, have 30 days, though Temporal holds only part of each.
  • Returns null on invalid input.
ParameterTypeDescription
valuestringa year-month, YYYY-MM

number of days in the month (28-31), or null on invalid input

import { getDaysInYearMonth } from "@northguild/gmt/plain/calculate";
getDaysInYearMonth("2024-02") // 29 (leap year)
output 

plain/calculate/getDaysInYearMonth.ts

Code examples: MIT-0. Packages: MIT. Third-party data and components: their own licences, credited where they appear. Everything else:© 2026 NorthGuild, all rights reserved.