parseYearMonthFromDateTime
Signature
Section titled “Signature”parseYearMonthFromDateTime(value: string): stringReturn the year-month (YYYY-MM) of an ISO 8601 date-time string.
- The day and the time are dropped, so the time never moves the month.
- A
Zor an offset gives""; a time zone annotation with no offset is ignored, asisValidDateTimereads it. - Only the ISO calendar is read.
- Returns "" for invalid input.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value | string | ISO date-time string |
Returns
Section titled “Returns”The canonical YYYY-MM string (±YYYYYY-MM outside 0000-9999), or "" on invalid input
Examples
Section titled “Examples”import { parseYearMonthFromDateTime } from "@northguild/gmt/plain/parse";
parseYearMonthFromDateTime("2026-10-01T10:00:00") // "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.