Skip to content

Commit

Permalink
fix(stats): fix home prices created today
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Jan 26, 2024
1 parent 7b4c50a commit f48c4ce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ function currentDate() {
return new Date().toISOString().substring(0, 10)
}

/**
* output: '2023-12-25T00:00:00.000Z'
*/
function currentStartOfDay() {
let today = new Date()
today.setUTCHours(0, 0, 0, 0)
return today.toISOString()
}

/**
* input: '2023-12-25'
* output: '12/25/2023'
Expand Down Expand Up @@ -130,6 +139,7 @@ function getLocationTitle(locationObject, withName=true, withRoad=false, withCit
export default {
addObjectToArray,
removeObjectFromArray,
currentStartOfDay,
currentDate,
prettyDate,
prettyDateTime,
Expand Down
2 changes: 1 addition & 1 deletion src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export default {
methods: {
getTodayPriceCount() {
this.loading = true
return api.getPrices({ date: utils.currentDate(), size: 1 })
return api.getPrices({ created__gte: utils.currentStartOfDay(), size: 2 })
.then((data) => {
this.todayPriceCount = data.total
this.loading = false
Expand Down

0 comments on commit f48c4ce

Please sign in to comment.