Skip to content

Commit

Permalink
fix: missing currentDay ChartPrice
Browse files Browse the repository at this point in the history
  • Loading branch information
Tien Nam Dao committed Jan 3, 2023
1 parent 34eb959 commit 9c50dc0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions views/homepage/Chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
} from 'chart.js'
import 'chartjs-adapter-dayjs'
import Spinner from 'components/Spinner'
import dayjs from 'dayjs'
import humps from 'humps'
import numeral from 'numeral'
import { Line } from 'react-chartjs-2'
Expand Down Expand Up @@ -48,6 +49,11 @@ function getPriceData(marketHistoryData) {
y: closingPrice
}))

// Because of data return not include today. Add this.
const prevDay = dayjs(data[0].x)
let curDay = prevDay.add(1, 'd')
data.unshift({ x: curDay, y: null })

setDataToLocalStorage('priceData', data)
return data
}
Expand Down

0 comments on commit 9c50dc0

Please sign in to comment.