Skip to content

Commit

Permalink
add ~ 5 minutes leeway to determine whether a date/time is in the past (
Browse files Browse the repository at this point in the history
#236)

* add ~ 5 minutes leeway to determine whether a date/time is in the past

* add ~ 5 minutes leeway to determine whether a date/time is in the past

* add comment per feedback

---------

Co-authored-by: Amy Chen <[email protected]>
  • Loading branch information
achen2401 and Amy Chen authored Jan 15, 2025
1 parent d402105 commit 534a996
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion patientsearch/src/js/helpers/utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,10 @@ export function isInPast(dateString) {
const today = new Date();
const targetDate = new Date(dateString);
if (!isValid(targetDate)) return false;
return targetDate < today;
const diff = (today - targetDate); // in miniseconds
// this will check if diff is 5 minutes or more
// e.g. pad by 5 mins to give system time to transmit message, rather than indicate no next message time during processing
return diff > (1000 * 60 * 5);
}

/*
Expand Down

0 comments on commit 534a996

Please sign in to comment.