adjusting dates to be human friendly

This commit is contained in:
2024-08-21 22:00:15 -06:00
parent ae704f7bae
commit c708ccdc5e
5 changed files with 59 additions and 52 deletions

View File

@@ -42,7 +42,14 @@ const parseDateOrThrow = (value: string, label: string): string => {
if (isNaN(date.getTime())) {
throw new Error(`Error with ${label}: ${value}`);
}
return date.toISOString();
const day = String(date.getDate()).padStart(2, "0");
const month = String(date.getMonth() + 1).padStart(2, "0"); // Months are zero-based
const year = date.getFullYear();
const hours = String(date.getHours()).padStart(2, "0");
const minutes = String(date.getMinutes()).padStart(2, "0");
const seconds = String(date.getSeconds()).padStart(2, "0");
return `${day}/${month}/${year} ${hours}:${minutes}:${seconds}`;
};
const parseDateOrNull = (value: string): string | undefined => {