formatDateRangeParameterPeriod()
Beta API. Mostly stable, but details may change in a minor release, outside SemVer. See API maturity.
Names the range of a date range parameter’s period, such as “August 2025 – August 2026”.
formatDateRangeParameterPeriod: (period: IDateRangeParameterPeriod, translator: IDateAndMessageTranslator, dateFormat?: string, weekStart?: WeekStart) => string | undefined
Parameters
Parameter | Type | Description |
|---|---|---|
period | the period of a date range parameter | |
translator | translator with the messages of | |
dateFormat | string | (Optional) date-fns format of a day, defaults to “MM/dd/yyyy” |
weekStart | (Optional) the first day of a week, defaults to Sunday |
Returns
string | undefined
the range, or undefined when the period has neither end
Remarks
The range reads as a static period of the date filter: years, quarters and months by their names, and weeks by their days, which depend on weekStart. Days are written in dateFormat in the translator’s locale, with the time for hours, minutes and seconds. A range within one day writes the day once, such as “08/14/2025, 09:00 – 17:59”, and a range that covers whole days writes only the days. An hour ends with its last minute. Days and times are wall-clock values, written as they are in every time zone. A period with one end reads “From August 2025” or “To August 2026”. An end that is not a valid literal of the granularity is written as it is.