diff --git a/src/utils.js b/src/utils.js index bebcb6e789..d9aaa098eb 100644 --- a/src/utils.js +++ b/src/utils.js @@ -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' @@ -130,6 +139,7 @@ function getLocationTitle(locationObject, withName=true, withRoad=false, withCit export default { addObjectToArray, removeObjectFromArray, + currentStartOfDay, currentDate, prettyDate, prettyDateTime, diff --git a/src/views/Home.vue b/src/views/Home.vue index be889bb393..e811005193 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -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