Skip to content

maxDate

maxDate(dates: string[]): string | null

Return the latest (maximum) of the given PlainDate values.

  • Returns null if the array is empty or contains no valid dates.
  • Validation is performed on each item in the array.
ParameterTypeDescription
datesstring[]Array of ISO PlainDate strings (e.g. “2024-03-10”)

The latest date string, or null on invalid input

import { maxDate } from "@northguild/gmt/plain/calculate";
maxDate(["2024-03-10", "2024-03-15", "2024-03-12"]) // "2024-03-15"
dates
output 

plain/calculate/maxDate.ts