Skip to content

getYear

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

Return the current year as a zero-padded string in the system timeZone.

  • Uses Temporal.Now.zonedDateTimeISO() to get current year in system timezone.
  • Returns zero-padded string (e.g., “2024”).
  • A year outside 0000–9999 is written with a sign and six digits (+010000, -000005), as Temporal writes it at the head of a date.
  • Returns "" when system timezone is unavailable.

current year string (zero-padded) or "" on invalid

import { getYear } from "@northguild/gmt/plain/get";
getYear() // "2024"
output 

plain/get/getYear.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.