adjust the kpi card minigraph to be limited by publish cutoff time
This commit is contained in:
1 parent
3ba6fed189
commit
155a24c7bd
3 files changed
+73
-10
No files matched your search
@@ -0,0 +1,18 @@
|
||||
/** Keep rows on or before the dashboard publish cutoff date (ISO `YYYY-MM-DD`). */
|
||||
export function throughVisibleDate<T extends { date: string }>(
|
||||
rows: T[],
|
||||
visibleThrough: string | null | undefined
|
||||
): T[] {
|
||||
if (!visibleThrough) return rows;
|
||||
return rows.filter((row) => row.date <= visibleThrough);
|
||||
}
|
||||
|
||||
/** True when `date` is on or before the publish cutoff (or cutoff is unknown). */
|
||||
export function isOnOrBeforeVisibleDate(
|
||||
date: string | null | undefined,
|
||||
visibleThrough: string | null | undefined
|
||||
): boolean {
|
||||
if (!date) return false;
|
||||
if (!visibleThrough) return true;
|
||||
return date <= visibleThrough;
|
||||
}
|
||||
Reference in new issue
Block a user