Skip to content

Commit

Permalink
Merge pull request CSCDP#13 from SocialFinanceDigitalLabs/fix-date-di…
Browse files Browse the repository at this point in the history
…splay

FAM-49: Fix date display
  • Loading branch information
Louisasa authored Feb 25, 2020
2 parents 8a4fa76 + 9d68fd0 commit 3443708
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion debug.log

This file was deleted.

6 changes: 3 additions & 3 deletions src/components/BasicDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

Expand Down

0 comments on commit 3443708

Please sign in to comment.