TimeCalendarUtils
Calendar time: describes a time relative to a
reference day with phrases like Today at 2:30 PM, Tomorrow at 9:00 AM, Last Friday at 5:00 PM, and falls back to a plain date outside of a week either way.
TimeCalendarUtils.calendar("2025-09-23T18:30:00Z", "2025-09-22T13:00:00Z") --> Tomorrow at 6:30 PM
TimeCalendarUtils.calendar(os.time() - 3 * 86400) --> Last Friday at 1:00 PM (for example)
Types
CalendarFormat
type CalendarFormat = TimeLocalizationUtils.CalendarFormatCalendarFormats
type CalendarFormats = TimeLocalizationUtils.CalendarFormatOverridesWhich phrase to use for each distance from the reference day. Missing keys fall back to the locale's defaults from TimeLocalizationUtils.getCalendarFormatsForLocale.
Functions
calendar
TimeCalendarUtils.calendar(currentTime: Time.DateTimeLike,referenceTime: Time.DateTimeLike,locale: string?) → string
Describes currentTime relative to the day of referenceTime (now when nil). Times within the same day, the next day, the previous day, the next six days and
the previous six days each get their own phrase; anything further is a plain date.
formats overrides any of the phrases, see CalendarFormats. The locale picks the
default phrases through TimeLocalizationUtils and applies to every template.