Skip to content

Commit

Permalink
feat: stick time range requests to nearest hours
Browse files Browse the repository at this point in the history
  • Loading branch information
ymarcon committed Oct 30, 2024
1 parent be09084 commit 08e3d21
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions frontend/src/stores/measures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ export const useMeasuresStore = defineStore('measures', () => {

watch(() => timeseriesStore.timeRange, async () => {
const startDateRange = timeseriesStore.timeRange[0];
startDateRange.setMinutes(0, 0, 0);
const endDateRange = timeseriesStore.timeRange[1];
endDateRange.setMinutes(0, 0, 0);
// Add one hour to round up to the nearest next hour
endDateRange.setHours(endDateRange.getHours() + 1);
// Calculate the time range in hours
const timeRangeHours = (endDateRange.getTime() - startDateRange.getTime()) / (1000 * 60 * 60);
if (timeRangeHours < 7 * 24) {
Expand Down

0 comments on commit 08e3d21

Please sign in to comment.