19 lines
434 B
JavaScript
19 lines
434 B
JavaScript
export function fmtDateTime(d) {
|
|
if (!d) return "";
|
|
try {
|
|
const dt = new Date(d);
|
|
const datePart = dt.toLocaleDateString("sl-SI", {
|
|
year: "numeric",
|
|
month: "2-digit",
|
|
day: "2-digit",
|
|
});
|
|
const timePart = dt.toLocaleTimeString("sl-SI", {
|
|
hour: "2-digit",
|
|
minute: "2-digit",
|
|
hour12: false,
|
|
});
|
|
return `${datePart} ${timePart}`;
|
|
} catch (e) {
|
|
return String(d);
|
|
}
|
|
}; |