diff --git a/packages/app/components/stackbox/Stackbox.tsx b/packages/app/components/stackbox/Stackbox.tsx index aec113db..d9706b08 100644 --- a/packages/app/components/stackbox/Stackbox.tsx +++ b/packages/app/components/stackbox/Stackbox.tsx @@ -58,7 +58,6 @@ interface SelectTokenButtonProps { onAnimationEnd: AnimationEventHandler; } const ONE_MINUTE = 1; -const TEN_MINUTES = 10; const ONE_MINUTE_IN_MS = 60000; const frequencyOptions = [ @@ -196,8 +195,11 @@ export const Stackbox = () => { */ useEffect(() => { function oneMinuteInterval() { - setStartDateTime(getDatePlusMinsOffset(startDateTime, TEN_MINUTES)); - setEndDateTime(getDatePlusMinsOffset(endDateTime, TEN_MINUTES)); + const startDateInThePast = startDateTime.getTime() <= Date.now(); + if (startDateInThePast) { + setStartDateTime(getDatePlusMinsOffset(startDateTime, ONE_MINUTE)); + setEndDateTime(getDatePlusMinsOffset(endDateTime, ONE_MINUTE)); + } } oneMinuteInterval(); @@ -607,7 +609,7 @@ export const Stackbox = () => { frequency={frequency} startTime={ isPastStartDate - ? new Date(getDatePlusMinsOffset(new Date(), TEN_MINUTES)) + ? new Date(getDatePlusMinsOffset(new Date(), ONE_MINUTE)) : startDateTime } endTime={endDateTime}