Skip to content

parseMonthDayFromDateTime

parseMonthDayFromDateTime(value: string): string

Return the month-day (--MM-DD) of an ISO 8601 date-time string.

  • The year and the time are dropped, so the time never moves the day.
  • A Z or an offset gives ""; a time zone annotation with no offset is ignored, as isValidDateTime reads it.
  • Only the ISO calendar is read.
  • Returns "" for invalid input.
ParameterTypeDescription
valuestringISO date-time string

The canonical --MM-DD string, or "" on invalid input

import { parseMonthDayFromDateTime } from "@northguild/gmt/plain/parse";
parseMonthDayFromDateTime("2024-12-25T10:00:00") // "--12-25"
output 

plain/parse/parseMonthDayFromDateTime.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.