From 9d68fd046b74ea776a32d736d2d2529d7327cf6a Mon Sep 17 00:00:00 2001 From: Alexander Read Date: Tue, 25 Feb 2020 15:21:52 +0000 Subject: [PATCH] FAM-49: Fix date display --- debug.log | 1 - src/components/BasicDetails.tsx | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) delete mode 100644 debug.log diff --git a/debug.log b/debug.log deleted file mode 100644 index e4668f7ad..000000000 --- a/debug.log +++ /dev/null @@ -1 +0,0 @@ -[0224/172050.165:ERROR:crash_report_database_win.cc(428)] unexpected header diff --git a/src/components/BasicDetails.tsx b/src/components/BasicDetails.tsx index 2b98178ae..8bc7cd26c 100644 --- a/src/components/BasicDetails.tsx +++ b/src/components/BasicDetails.tsx @@ -6,13 +6,13 @@ import TitleValuePair from './Table/TitleValuePair'; const BasicDetails: React.FC<{ personDetails: PersonDetails }> = (props: { personDetails: PersonDetails }) => { - const formatDateOrString: (maybeDate: Date | string) => string = (maybeDate: Date|string) => { + const formatDateOrString: (maybeDate: string | Date) => string = (maybeDate: Date|string) => { let date = new Date(maybeDate); - if (date.hasOwnProperty("toLocaleDateString")) { + if ((date as Date).getDate()) { return date.toLocaleDateString(); } else { - return props.personDetails.dateOfBirth.toString(); + return (date as Date).getDate().toString(); } }