Skip to content

Commit

Permalink
DBC22-2024: fixed date processing format in Safari
Browse files Browse the repository at this point in the history
  • Loading branch information
ray-oxd committed Apr 15, 2024
1 parent 89c3bfd commit b2e9cd7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/frontend/src/Components/OpenSeason.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ export default function OpenSeason({ openDate, closeDate, returnState=false}) {

const today = new Date();
const year = today.getFullYear();
const openDateY = new Date(openDate.toString() + "-" + year.toString());
const closeDateY = new Date(closeDate.toString() + "-" + year.toString());
const openDateY = new Date(year.toString() + "-" + openDate.toString());
const closeDateY = new Date(year.toString() + "-" + closeDate.toString());

const openDateFormatted = formatter.format(openDateY);
const closeDateFormatted = formatter.format(closeDateY);

if (returnState) {
const isInSeason = (today.getTime() > openDateY.getTime()) && (today.getTime() < closeDateY.getTime());

if (isInSeason)
return "open";
else
else
return "closed";
}

return <p>{openDateFormatted}{closeDateFormatted}</p>;
}
4 changes: 2 additions & 2 deletions src/frontend/src/Components/data/restStops.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export function isRestStopClosed(restStopProperties) {
const openDate = restStopProperties.OPEN_DATE;
const closeDate = restStopProperties.CLOSE_DATE;
if(openDate && closeDate){
const openDateY = new Date(openDate.toString() + "-" + year.toString());
const closeDateY = new Date(closeDate.toString() + "-" + year.toString());
const openDateY = new Date(year.toString() + "-" + openDate.toString());
const closeDateY = new Date(year.toString() + "-" + closeDate.toString());
const isInSeason = (today.getTime() > openDateY.getTime()) && (today.getTime() < closeDateY.getTime());
const isClosed = isInSeason? false: true;
return isClosed;
Expand Down

0 comments on commit b2e9cd7

Please sign in to comment.