Novis\Intl\RelativeTime
Writes an amount of time before or after now, such as "3 days ago", the way a language writes it. The method takes a whole list and a locale tag, such as "de", and formats it in one call.
Members
1 member.
| Member | Signature |
|---|---|
format | format(array<{ count: int, unit: Unit }> $items, string $locale, ?{ width?: Width, numeric?: Numeric } $options = null): array<string> |
Enums
Unit { Second, Minute, Hour, Day, Week, Month, Quarter, Year }The unit of time thatRelativeTime::formatwrites.RelativeTime::formatwrites a count of a unit as a time before or after now. A count of -2 withWeekgives "2 weeks ago". A positive count is in the future.Quarteris three months.Numeric { Always, Auto }WhetherRelativeTime::formatalways writes a number.RelativeTime::formatwrites a time before or after now, such as "in 1 day".Alwayswrites the counts -1, 0 and 1 ofDayas "1 day ago", "in 0 days" and "in 1 day". This is the default.Autowrites the same counts as "yesterday", "today" and "tomorrow". Most counts have no word like these, such as the count 5. For such a count,Autoalso writes the number: "in 5 days".
