fn
formatDate
testeddemoFormat a `Date` against a token string. Exposed for one-shot, non-reactive formatting; {@link useDateFormat} wraps this in a `computed`.
Demo
Loading demo…
Signature
ts
export function formatDate(
date: Date,
formatStr: string,
options: UseDateFormatOptions ={ ... }Parameters
| Parameter | Type | Description |
|---|---|---|
date | Date | The date to format |
formatStr | string | The combination of tokens (e.g. `'YYYY-MM-DD HH:mm:ss'`) |
options? | UseDateFormatOptions | Locale and meridiem options |
Returns
stringThe formatted string