shortDate()
ts
function shortDate(date: Date): undefined | string;
Formats a given date to a short date string which is used e.g. in datetime element attributes.
Parameters
date
Date
= ...
The date to format. Defaults to the current date.
Returns
undefined
| string
A string in the format 'YYYY-MM-DD'.
Example
ts
shortDate(new Date(2025, 6, 12)) // '2025-07-12'