Skip to content

areYearMonthsEqual

areYearMonthsEqual(a: string, b: string): boolean

Check whether two year-month strings (YYYY-MM) name the same year and month.

  • Accepts both year forms, so 2026-10 and +002026-10 are equal.
  • Returns false if either input is invalid or not in the ISO calendar.
ParameterTypeDescription
astringyear-month string
bstringyear-month string

true only when both are valid and name the same year and month, or false on invalid input

import { areYearMonthsEqual } from "@northguild/gmt/plain/compare";
areYearMonthsEqual("+002026-10", "2026-10") // true
output 

plain/compare/areYearMonthsEqual.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.