Skip to content

parseMonthFromUtc

parseMonthFromUtc(value: string): string
import { parseMonthFromUtc } from "@northguild/gmt/utc/parse";

Return the month (1-12) from a UTC datetime string.

  • Returns zero-padded string for month.
  • Returns “” for invalid input.
Parameter Type Description
value string ISO UTC datetime string (e.g., “2024-03-17T14:30:45Z”)

Month (01-12) or “” on invalid input

parseMonthFromUtc("2024-03-17T14:30:45Z") // "03"
parseMonthFromUtc("invalid") // ""

utc/parse/parseMonthFromUtc.ts