mirror of
https://github.com/zadam/trilium.git
synced 2025-11-03 03:46:37 +01:00
14 lines
500 B
JavaScript
14 lines
500 B
JavaScript
|
|
/**
|
||
|
|
* Formats the given date to a string based on the current locale.
|
||
|
|
* @param {Date | number} date
|
||
|
|
* @param {"full" | "long" | "medium" | "short" | undefined} dateStyle
|
||
|
|
* @param {"full" | "long" | "medium" | "short" | undefined} tiemStyle
|
||
|
|
*/
|
||
|
|
export function formatDate(date, dateStyle = "medium", tiemStyle = "medium") {
|
||
|
|
const formatter = new Intl.DateTimeFormat(navigator.language, {
|
||
|
|
dateStyle: "medium",
|
||
|
|
timeStyle: "medium"
|
||
|
|
});
|
||
|
|
|
||
|
|
return formatter.format(date);
|
||
|
|
}
|