import moment from "moment"; export function dateSorter(a: any, b: any, direction: "asc" | "desc", key: string) { if (!a[key] && b[key]) return direction === "asc" ? -1 : 1; if (a[key] && !b[key]) return direction === "asc" ? 1 : -1; if (!a[key] && !b[key]) return 0; if (moment(a[key]).isAfter(b[key])) return direction === "asc" ? -1 : 1; if (moment(b[key]).isAfter(a[key])) return direction === "asc" ? 1 : -1; return 0; } export function env(key: string) { return (window as any).__ENV[key]; }