parseYearMonthFromDate
Signature
Section titled “Signature”parseYearMonthFromDate(value: string): stringReturn the year-month (YYYY-MM) of an ISO 8601 date string.
- The day is dropped, so
2026-10-01and2026-10-31give the same year-month. - Only the ISO calendar is read; a Hebrew or Islamic date gives
"". - Returns "" for invalid input.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value | string | ISO date string |
Returns
Section titled “Returns”The canonical YYYY-MM string (±YYYYYY-MM outside 0000-9999), or "" on invalid input
Examples
Section titled “Examples”import { parseYearMonthFromDate } from "@northguild/gmt/plain/parse";
parseYearMonthFromDate("2026-10-01") // "2026-10"Source
Section titled “Source”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.