diff --git a/src/alerts/course-start-alert/CourseStartAlert.jsx b/src/alerts/course-start-alert/CourseStartAlert.jsx index abe666fa..bcd68367 100644 --- a/src/alerts/course-start-alert/CourseStartAlert.jsx +++ b/src/alerts/course-start-alert/CourseStartAlert.jsx @@ -11,7 +11,9 @@ import { Info } from '@edx/paragon/icons'; import { useModel } from '../../generic/model-store'; -const DAY_MS = 24 * 60 * 60 * 1000; // in ms +const DAY_SEC = 24 * 60 * 60; // in seconds +const DAY_MS = DAY_SEC * 1000; // in ms +const YEAR_SEC = 365 * DAY_SEC; // in seconds function CourseStartAlert({ payload }) { const { @@ -25,15 +27,17 @@ function CourseStartAlert({ payload }) { const timezoneFormatArgs = userTimezone ? { timeZone: userTimezone } : {}; + const delta = new Date(startDate) - new Date(); const timeRemaining = ( ); - - const delta = new Date(startDate) - new Date(); if (delta < DAY_MS) { return ( diff --git a/src/course-home/outline-tab/alerts/course-end-alert/CourseEndAlert.jsx b/src/course-home/outline-tab/alerts/course-end-alert/CourseEndAlert.jsx index 97b02519..52287fb1 100644 --- a/src/course-home/outline-tab/alerts/course-end-alert/CourseEndAlert.jsx +++ b/src/course-home/outline-tab/alerts/course-end-alert/CourseEndAlert.jsx @@ -9,7 +9,9 @@ import { import { Alert } from '@edx/paragon'; import { Info } from '@edx/paragon/icons'; -const DAY_MS = 24 * 60 * 60 * 1000; // in ms +const DAY_SEC = 24 * 60 * 60; // in seconds +const DAY_MS = DAY_SEC * 1000; // in ms +const YEAR_SEC = 365 * DAY_SEC; // in seconds function CourseEndAlert({ payload }) { const { @@ -20,16 +22,19 @@ function CourseEndAlert({ payload }) { const timezoneFormatArgs = userTimezone ? { timeZone: userTimezone } : {}; + let msg; + const delta = new Date(endDate) - new Date(); const timeRemaining = ( ); - let msg; - const delta = new Date(endDate) - new Date(); if (delta < DAY_MS) { const courseEndTime = (