Updated intl formatters

This commit is contained in:
2024-11-14 17:24:12 +01:00
parent 96b145a8ad
commit a9b1d5ba67
6 changed files with 37 additions and 25 deletions

View File

@@ -1,12 +1,24 @@
const numberFormatter = new Intl.NumberFormat("en-US")
export function numberFormatter(d: number): string {
return new Intl.NumberFormat("en-US").format(d)
}
const dateTimeFormatter = new Intl.DateTimeFormat("hr-HR", {
year: "numeric",
month: "numeric",
day: "numeric",
hour: "numeric",
minute: "numeric",
second: "numeric"
})
export function dateTimeFormatter(d: Date): string {
return new Intl.DateTimeFormat("hr-HR", {
year: "numeric",
month: "numeric",
day: "numeric",
hour: "numeric",
minute: "numeric",
second: "numeric"
}).format(d)
}
export { dateTimeFormatter, numberFormatter }
export function logTimeFormatter(d: Date): string {
return new Intl.DateTimeFormat("hr-HR", {
year: "numeric",
month: "numeric",
day: "numeric",
hour: "numeric",
minute: "numeric"
}).format(d)
}