Added daytime property

This commit is contained in:
2026-06-24 16:04:17 -04:00
parent 122bbab555
commit 1c0416c668
3 changed files with 10 additions and 14 deletions

View File

@@ -79,7 +79,7 @@ app.get('/api/hourly', async (req, res) => {
historyEnd.setMinutes(0, 0, 0)
const [historyResult] = await Promise.allSettled([
start < now ? queryHourly(start.toISOString(), historyEnd.toISOString()) : Promise.resolve([])
start < now ? queryHourly(start, historyEnd) : Promise.resolve([])
])
const history = historyResult.status === 'fulfilled' ? historyResult.value : []
@@ -112,13 +112,13 @@ app.get('/api/daily', async (req, res) => {
const coords = await getCoords()
// Does the requested window overlap with today (the 24h forecast window)?
const todayStr = now.toISOString().slice(0, 10)
const todayStr = now
const { summary } = await ensureForecast()
const usePhysics = summary && start <= next && end >= now
// Past influx history (days before today)
const [sensorResult] = await Promise.allSettled([
start < now ? queryDaily(start.toISOString(), now.toISOString()) : Promise.resolve([])
start < now ? queryDaily(start, now) : Promise.resolve([])
])
const history = sensorResult.status === 'fulfilled' ? sensorResult.value : []