mirror of
https://github.com/hay-kot/homebox.git
synced 2025-06-01 01:52:30 +00:00
refactor: editor page (#276)
This commit is contained in:
parent
9361997a42
commit
986d2c586e
3 changed files with 82 additions and 34 deletions
|
@ -5,7 +5,7 @@ const ZERO_DATE = "0001-01-01T00:00:00Z";
|
|||
type BaseApiType = {
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
|
@ -26,7 +26,11 @@ export function parseDate<T>(obj: T, keys: Array<keyof T> = []): T {
|
|||
return;
|
||||
}
|
||||
|
||||
result[key] = new Date(result[key]);
|
||||
// transform string to ensure dates are parsed as UTC dates instead of
|
||||
// localized time stamps
|
||||
const asStr = result[key] as string;
|
||||
const cleaned = asStr.replaceAll("-", "/").split("T")[0];
|
||||
result[key] = new Date(cleaned);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue