temporal-fns
API reference

max

API index · Input types and conventions · Installation

max(values) → input kind | undefined

Select the latest value. Equal maxima retain the first original object.

import { max } from '@frantss/temporal-fns';

const early = Temporal.PlainYearMonth.from('2026-10');
const late = Temporal.PlainYearMonth.from('2027-01');
max([late, early]) === late; // => true
max([late, Temporal.PlainYearMonth.from('2027-01')]) === late; // => true
max([]); // => undefined

Related: min, closestTo, clamp.

Behaviors: SEL-001: Minima and maxima preserve the selected object; SEL-003: Empty collections return undefined; SEL-004: Equal extrema keep the first occurrence; SEL-005: Exact time, rather than displayed local order, orders zoned values.