[READ-ONLY] a fast, modern browser for the npm registry
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: set default end date to yesterday on weekly downloads chart (#14)

authored by

Alec Lloyd Probert and committed by
GitHub
6c983aa5 8416aa89

+8 -1
+8 -1
app/composables/useNpmRegistry.ts
··· 171 171 async () => { 172 172 const packageName = toValue(name) 173 173 const { weeks = 12, endDate } = toValue(options) ?? {} 174 - const end = endDate ? new Date(`${endDate}T00:00:00.000Z`) : new Date() 174 + 175 + const today = new Date() 176 + const yesterday = new Date( 177 + Date.UTC(today.getUTCFullYear(), today.getUTCMonth(), today.getUTCDate() - 1), 178 + ) 179 + 180 + const end = endDate ? new Date(`${endDate}T00:00:00.000Z`) : yesterday 181 + 175 182 const start = addDays(end, -(weeks * 7) + 1) 176 183 const startIso = toIsoDateString(start) 177 184 const endIso = toIsoDateString(end)