Skip to content

Commit

Permalink
bugFix - TypeError related to Date object
Browse files Browse the repository at this point in the history
  • Loading branch information
Amy Chen committed Aug 4, 2023
1 parent 0e8dca1 commit f12979b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion patientsearch/src/js/components/PatientListTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ export default function PatientListTable() {
}
let value = nodes && nodes.length ? nodes[nodes.length-1].value : null;
if (dataType === "date") {
value = getLocalDateTimeString(value);
value = value ? getLocalDateTimeString(value) : "--";
}
if (dataType === "timeago" && value) {
value = getTimeAgoDisplay(new Date(value));
Expand Down
1 change: 1 addition & 0 deletions patientsearch/src/js/helpers/utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ export function getLocalDateTimeString(utcDateString, shortFormat) {
//note javascript Date object automatically convert UTC date/time to locate date/time, no need to parse and convert
let dateObj =
utcDateString instanceof Date ? utcDateString : new Date(utcDateString);
if (!isValid(dateObj)) return utcDateString;
let year = dateObj.getFullYear();
let month = pad(dateObj.getMonth() + 1);
let day = pad(dateObj.getDate());
Expand Down

0 comments on commit f12979b

Please sign in to comment.