From 7c094100245e58725237ac5e079d0106fefbff0b Mon Sep 17 00:00:00 2001 From: frozenhelium Date: Fri, 1 Dec 2023 16:44:23 +0545 Subject: [PATCH] WIP --- src/utils/common.ts | 16 ++++++++++++++++ .../RapidResponsePerosnnelTable/index.tsx | 7 ++++++- .../styles.module.css | 5 +++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 src/views/EmergencySurge/RapidResponsePerosnnelTable/styles.module.css diff --git a/src/utils/common.ts b/src/utils/common.ts index 0abf2278d9..42c45b68c4 100644 --- a/src/utils/common.ts +++ b/src/utils/common.ts @@ -668,3 +668,19 @@ export function addNumMonthsToDate( return dateSafe; } + +export function isValidDate( + value: T | null | undefined, +): value is T { + if (isNotDefined(value)) { + return false; + } + + const date = new Date(value); + + if (Number.isNaN(date.getTime())) { + return false; + } + + return true; +} diff --git a/src/views/EmergencySurge/RapidResponsePerosnnelTable/index.tsx b/src/views/EmergencySurge/RapidResponsePerosnnelTable/index.tsx index f96d794350..11de870680 100644 --- a/src/views/EmergencySurge/RapidResponsePerosnnelTable/index.tsx +++ b/src/views/EmergencySurge/RapidResponsePerosnnelTable/index.tsx @@ -23,6 +23,7 @@ import { numericIdSelector } from '#utils/selectors'; import useFilterState from '#hooks/useFilterState'; import i18n from './i18n.json'; +import styles from './styles.module.css'; type PersonnelTableItem = NonNullable['results']>[number]; const now = new Date().toISOString(); @@ -76,7 +77,10 @@ export default function RapidResponsePersonnelTable(props: Props) { 'role', strings.personnelTablePosition, (item) => item.role, - { sortable: true }, + { + sortable: true, + columnClassName: styles.role, + }, ), createStringColumn( 'type', @@ -137,6 +141,7 @@ export default function RapidResponsePersonnelTable(props: Props) { return (