From 882b42926337a61e405fa51fdbf6ad4dc2263b52 Mon Sep 17 00:00:00 2001 From: Dmytro Shcherbonos Date: Mon, 11 Sep 2023 15:21:04 +0300 Subject: [PATCH] recurring: add 15 minutes to the end time --- src/redux/sagas/ao/schedule_recurring_ao.js | 1 - src/util/date.js | 9 ++++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/redux/sagas/ao/schedule_recurring_ao.js b/src/redux/sagas/ao/schedule_recurring_ao.js index 83c20c831..dad35b098 100644 --- a/src/redux/sagas/ao/schedule_recurring_ao.js +++ b/src/redux/sagas/ao/schedule_recurring_ao.js @@ -14,7 +14,6 @@ import WSTypes from '../../constants/ws' const debug = Debug('hfui:recurring-ao') function* purgeSchedulerOnAlgoOrderChange({ gid, sagaToExecute }) { - console.log('before race') const { cancel } = yield race({ delay: sagaToExecute, cancel: take((action) => { diff --git a/src/util/date.js b/src/util/date.js index 442f75442..b9ec7d162 100644 --- a/src/util/date.js +++ b/src/util/date.js @@ -1,5 +1,5 @@ import { - isValid, format, startOfDay, addDays, + isValid, format, startOfDay, addDays, addMinutes, } from 'date-fns' import Debug from 'debug' import i18n, { DATE_FNS_LOCALES, LANGUAGES } from '../locales/i18n' @@ -66,6 +66,9 @@ export const roundDay = (firstDate, secondDate) => { const roundedFirstDateMs = startOfDay(firstDate).getTime() const secondDateMs = new Date(secondDate).getTime() - const daysDifference = Math.floor((secondDateMs - roundedFirstDateMs) / TIMEFRAME_WIDTHS['1D']) - return addDays(firstDate, daysDifference) + const daysDifference = Math.floor( + (secondDateMs - roundedFirstDateMs) / TIMEFRAME_WIDTHS['1D'], + ) + // add 15 minutes to the end time + return addMinutes(addDays(firstDate, daysDifference), 15) }