diff --git a/src/frontend/src/Components/OpenSeason.js b/src/frontend/src/Components/OpenSeason.js index 19d391e3..b68c8916 100644 --- a/src/frontend/src/Components/OpenSeason.js +++ b/src/frontend/src/Components/OpenSeason.js @@ -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

{openDateFormatted} – {closeDateFormatted}

; } diff --git a/src/frontend/src/Components/data/restStops.js b/src/frontend/src/Components/data/restStops.js index 9522be5f..af8328b5 100644 --- a/src/frontend/src/Components/data/restStops.js +++ b/src/frontend/src/Components/data/restStops.js @@ -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;