build-address added tested
This commit is contained in:
@@ -9,4 +9,20 @@ export function dateToLocaleString(date: string) {
|
||||
return new Date(date).toLocaleString("en-US",
|
||||
{ timeZone: "Europe/Istanbul", hour12: false, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit" }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export function toISOIfNotZ(val: string): string {
|
||||
if (val.endsWith("Z")) return val;
|
||||
const [d, m, yAndTime] = val.split("/");
|
||||
if (!yAndTime) return val;
|
||||
const [y, time] = yAndTime.split(" ");
|
||||
if (!time) return val;
|
||||
const [h, min, s] = time.split(":").map(Number);
|
||||
try {
|
||||
const date = new Date(Number(y), Number(m) - 1, Number(d), h, min, s);
|
||||
return date ? date.toISOString() : "";
|
||||
} catch (error) {
|
||||
console.error("Error converting date:", error);
|
||||
return val;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user