Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

Commit

Permalink
Fixed small utc bug in calcs of daily chart
Browse files Browse the repository at this point in the history
  • Loading branch information
coltoneshaw committed Jan 4, 2022
1 parent 2629b0e commit 7c243e3
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/app/Pages/DailyStats/logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,24 +50,20 @@ const blankDashboard = {
}
}

const returnTodayUtcEnd = (date: Date) => {
// if (!date) date = new Date();
return moment.utc(date)
.endOf("day")
.valueOf();
}
const returnTodayUtcEnd = (date: Date) => moment.utc(date).endOf("day").valueOf();


type filters = {
accounts: number[] | [],
currency: string[] | string
}

const oneMilliHour = 86400000
const oneMillisecondDay = 86400000

export const queryDayDashboard = async (utcEndDate: number, profileData: Type_Profile, filters: filters) => {

const utcStartDate = utcEndDate - oneMilliHour - 1
// removing a day, then adding a millisecond to round to the beginning of the UTC day
const utcStartDate = utcEndDate - oneMillisecondDay + 1
const utcDateRange = { utcEndDate, utcStartDate }
const [ pairDay, botDay, dailyProfit, totalProfit, activeDeals] = await Promise.all([
queryDealByPairByDay(profileData, utcDateRange, filters),
Expand Down

0 comments on commit 7c243e3

Please sign in to comment.