Skip to content

Commit

Permalink
recurring: add 15 minutes to the end time
Browse files Browse the repository at this point in the history
  • Loading branch information
dmytroshch committed Sep 11, 2023
1 parent 50022c0 commit 882b429
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/redux/sagas/ao/schedule_recurring_ao.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
9 changes: 6 additions & 3 deletions src/util/date.js
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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)
}

0 comments on commit 882b429

Please sign in to comment.