Skip to content

Sys.Date

Sys.Date formats dates in the language of the current End user and gives access to the bundled date-fns library for date arithmetic and parsing.

Availability: Everywhere

format(date: Date | number, format: string): string

Formats a date with a date-fns format pattern, using the date locale of the current language. If no date locale is loaded for the current language, Lowgile uses the default language’s locale, then en-US. Month and weekday names, and localized patterns such as P or PPPP, follow that locale.

ParameterTypeDescription
dateDate | numberDate to format, or a timestamp in milliseconds since 1 January 1970 UTC.
formatstringPattern in the date-fns syntax, for example 'dd.MM.yyyy HH:mm' or 'PPP'. See the date-fns format documentation for all tokens.
Sys.Date.format(order.createdAt, 'dd.MM.yyyy') // e.g. "28.10.2026"
Sys.Date.format(Date.now(), 'EEEE, PPP') // e.g. "Wednesday, October 28th, 2026"

Returns: string · Availability: Everywhere

Note

null and undefined are accepted at runtime and give an empty string, although the type check rejects them.

readonly fns: typeof fns

The date-fns library (version ^2.30.0), as-is. It adds, subtracts, compares, parses and formats dates. Its functions use the en-US locale unless you pass a locale option; for formatting in the End user’s language, use format() instead.

Upstream documentation: date-fns v2.30.0

const dueDate = Sys.Date.fns.addDays(new Date(), 30)

Type: typeof fns · Availability: Everywhere