Skip to content

Commit 1dc9041

Browse files
committed
fix the rabbit
1 parent 626d233 commit 1dc9041

3 files changed

Lines changed: 25 additions & 5 deletions

File tree

app/components/Package/TrendsChart.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,12 @@ const isEndDateOnPeriodEnd = computed(() => {
385385
// The last week bucket is complete when the range length is divisible by 7
386386
const startIso = String(startDate.value ?? '').slice(0, 10)
387387
if (!/^\d{4}-\d{2}-\d{2}$/.test(startIso)) return false
388-
const startMs = Date.UTC(...(startIso.split('-').map(Number) as [number, number, number]))
388+
const [startYear, startMonth, startDay] = startIso.split('-').map(Number) as [
389+
number,
390+
number,
391+
number,
392+
]
393+
const startMs = Date.UTC(startYear, startMonth - 1, startDay)
389394
const endMs = Date.UTC(year, month - 1, day)
390395
const totalDays = Math.floor((endMs - startMs) / 86400000) + 1
391396
return totalDays % 7 === 0
@@ -1659,7 +1664,7 @@ watch(selectedMetric, value => {
16591664
</div>
16601665

16611666
<!-- Download filter controls -->
1662-
<div v-if="isDownloadsMetric" class="flex flex-col gap-2">
1667+
<div v-if="selectedMetric !== 'contributors'" class="flex flex-col gap-2">
16631668
<button
16641669
type="button"
16651670
class="self-start flex items-center gap-1 text-2xs font-mono text-fg-subtle hover:text-fg transition-colors"

app/composables/useSettings.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,22 @@ let settingsRef: RemovableRef<AppSettings> | null = null
8585
export function useSettings() {
8686
if (!settingsRef) {
8787
settingsRef = useLocalStorage<AppSettings>(STORAGE_KEY, DEFAULT_SETTINGS, {
88-
mergeDefaults: true,
88+
mergeDefaults: (stored, defaults) => ({
89+
...defaults,
90+
...stored,
91+
connector: {
92+
...defaults.connector,
93+
...stored?.connector,
94+
},
95+
sidebar: {
96+
...defaults.sidebar,
97+
...stored?.sidebar,
98+
},
99+
chartFilter: {
100+
...defaults.chartFilter,
101+
...stored?.chartFilter,
102+
},
103+
}),
89104
})
90105
}
91106

app/utils/chart-data-prediction.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ function clampRatio(value: number): number {
1313
return value
1414
}
1515

16-
/** Convert `YYYY-MM-DD` to UTC ms at end-of-day (`23:59:59.999`). */
16+
/** Convert `YYYY-MM-DD` to an exclusive UTC upper bound (next day at `00:00`). */
1717
export function endDateOnlyToUtcMs(d: string): number | null {
1818
if (!/^\d{4}-\d{2}-\d{2}$/.test(d)) return null
1919
const [y, m, day] = d.split('-').map(Number)
2020
if (!y || !m || !day) return null
21-
return Date.UTC(y, m - 1, day, 23, 59, 59, 999)
21+
return Date.UTC(y, m - 1, day + 1)
2222
}
2323

2424
/** Start of the bucket containing `ts` (inclusive). */

0 commit comments

Comments
 (0)