Skip to content

parseYearFromDateTime

  • The core functions, which every industry uses.
parseYearFromDateTime(value: string): string

Return the year for a given ISO 8601 datetime string.

  • Returns the year as Temporal writes it: four digits ("2024", "0005"), or a sign and six digits outside 0000–9999 ("+010000", "-000005").
  • Returns "" for invalid input.
ParameterTypeDescription
valuestringISO datetime string

the year as four digits, or a sign and six digits outside 0000–9999, or "" on invalid input

import { parseYearFromDateTime } from "@northguild/gmt/plain/parse";
parseYearFromDateTime("2024-03-15T12:30:00") // "2024"
output 

plain/parse/parseYearFromDateTime.ts

Accessibility
© 2026 NorthGuild · Licences

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.