Skip to content

datepicker improvements#788

Open
nerumo wants to merge 2 commits intoActivityWatch:masterfrom
nerumo:master
Open

datepicker improvements#788
nerumo wants to merge 2 commits intoActivityWatch:masterfrom
nerumo:master

Conversation

@nerumo
Copy link
Contributor

@nerumo nerumo commented Mar 19, 2026

  • support start of week
  • add next/previous day buttons
image

@codecov
Copy link

codecov bot commented Mar 19, 2026

Codecov Report

❌ Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 25.72%. Comparing base (f5ff831) to head (0462bc9).

Files with missing lines Patch % Lines
src/util/time.ts 33.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #788      +/-   ##
==========================================
+ Coverage   25.71%   25.72%   +0.01%     
==========================================
  Files          30       30              
  Lines        1754     1757       +3     
  Branches      315      321       +6     
==========================================
+ Hits          451      452       +1     
- Misses       1234     1236       +2     
  Partials       69       69              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 19, 2026

Greptile Summary

This PR enhances the date-picker experience across the app by (1) replacing native <input type="date"> elements in InputTimeInterval.vue with BootstrapVue b-form-datepicker components, (2) adding previous/next day navigation arrow buttons so users can shift the selected range without re-opening the picker, and (3) wiring the existing startOfWeek user setting (via the new get_first_day_of_week() utility in src/util/time.ts) into both the InputTimeInterval and QueryOptions datepickers so the calendar grid starts on the user's preferred day.

Key changes:

  • src/util/time.ts: New get_first_day_of_week() function maps "Sunday" / "Monday" / "Saturday" to the corresponding BootstrapVue start-weekday integers (0, 1, 6). This exactly covers the three options exposed in DaystartSettings.vue.
  • src/components/InputTimeInterval.vue: Swaps to b-form-datepicker, preserves :min/:max date constraints, and introduces shiftDays(n) to advance or rewind the entire range by n days. The arrow buttons are guarded behind v-if="mode == 'range'" and the method itself returns early when start is null.
  • src/components/QueryOptions.vue: Adds the same firstDayOfWeek computed property and forwards :start-weekday to both datepickers.
  • The hardcoded min-width: 300px per picker results in a minimum row width of ~700 px, which may overflow on narrower display configurations. A flexible sizing approach (e.g. flex: 1 1 auto with a smaller min-width) would be more robust.

Confidence Score: 3/5

  • This PR is mostly safe to merge; the main open concern is the wide fixed min-width that may cause layout overflow on smaller screens.
  • The core logic (date shifting, start-of-week wiring, min/max date constraints) is correct and the new utility is well-scoped to the three valid setting values. However, the two 300 px minimum-width datepickers side-by-side with navigation buttons create a row that is likely to overflow on many screen sizes, which is a visible UX regression. Additionally, a TypeScript type is missing on the shiftDays parameter. Several issues flagged in earlier review rounds (wrong prop name in QueryOptions, duplicated computed property) are still unresolved.
  • Pay attention to src/components/InputTimeInterval.vue — specifically the min-width: 300px CSS rule and the untyped shiftDays parameter. Also review the still-open QueryOptions.vue :start-weekday vs :first-day-of-week prop name issue from earlier threads.

Important Files Changed

Filename Overview
src/util/time.ts Adds get_first_day_of_week() utility that maps the three valid startOfWeek setting values ("Sunday" → 0, "Monday" → 1, "Saturday" → 6) to BootstrapVue start-weekday numbers. The mapping exactly matches the options exposed in DaystartSettings.vue, and the fallback of 1 (Monday) is a sensible default.
src/components/InputTimeInterval.vue Replaces native <input type="date"> elements with b-form-datepicker, wires up firstDayOfWeek from the settings store, and adds prev/next day shift buttons. The shiftDays method is guarded against a null start, and :min/:max constraints are preserved. Minor concerns: shiftDays has an untyped n parameter, and the hardcoded min-width: 300px per picker creates a wide row (~700+ px) that may overflow on narrower layouts.
src/components/QueryOptions.vue Adds firstDayOfWeek computed property and passes :start-weekday to both datepickers. Logic is correct and mirrors the pattern in InputTimeInterval.vue.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[User clicks ← / → arrow] --> B{start is null?}
    B -- Yes --> C[return early — no-op]
    B -- No --> D[Shift start by n days]
    D --> E{end is set?}
    E -- Yes --> F[Shift end by n days]
    E -- No --> G[applyRange]
    F --> G
    G --> H[mode = 'range', duration = 0]
    H --> I[valueChanged]
    I --> J{mode == 'last_duration' OR valid range?}
    J -- Yes --> K[emit 'input' with new date range]
    J -- No --> L[emit suppressed — invalid/too-long range]
Loading

Last reviewed commit: "feat: improve timeli..."

- support start of week
- add next/previous day buttons
- support start of week
- add next/previous day buttons
@ErikBjare
Copy link
Member

@greptileai review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants