mirror of
https://github.com/hay-kot/homebox.git
synced 2025-05-22 21:32:28 +00:00
feat: new-card-design (#196)
* card option 1 * UI updates for item card * fix test error * fix pagination issues on backend * add integer support * remove date from cards * implement pagination for search page * resolve search state problems * other fixes * fix broken datetime * attempt to fix scroll behavior
This commit is contained in:
parent
58d6f9a28c
commit
891d41b75f
19 changed files with 393 additions and 142 deletions
|
@ -1,5 +1,7 @@
|
|||
import { Requests } from "../../requests";
|
||||
|
||||
const ZERO_DATE = "0001-01-01T00:00:00Z";
|
||||
|
||||
type BaseApiType = {
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
|
@ -16,6 +18,14 @@ export function parseDate<T>(obj: T, keys: Array<keyof T> = []): T {
|
|||
[...keys, "createdAt", "updatedAt"].forEach(key => {
|
||||
// @ts-ignore - TS doesn't know that we're checking for the key above
|
||||
if (hasKey(result, key)) {
|
||||
if (result[key] === ZERO_DATE) {
|
||||
const dt = new Date();
|
||||
dt.setFullYear(1);
|
||||
|
||||
result[key] = dt;
|
||||
return;
|
||||
}
|
||||
|
||||
// Ensure date like format YYYY/MM/DD - otherwise results will be 1 day off
|
||||
const dateStr: string = result[key].split("T")[0].replace(/-/g, "/");
|
||||
result[key] = new Date(dateStr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue