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
Copy Markdown
Contributor

@nerumo nerumo commented Mar 19, 2026

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

@codecov
Copy link
Copy Markdown

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.93%. Comparing base (a15cc2b) to head (d1bfe81).

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.92%   25.93%   +0.01%     
==========================================
  Files          30       30              
  Lines        1759     1762       +3     
  Branches      307      322      +15     
==========================================
+ Hits          456      457       +1     
+ Misses       1281     1236      -45     
- Partials       22       69      +47     

☔ 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
Copy Markdown
Contributor

greptile-apps bot commented Mar 19, 2026

Greptile Summary

This PR improves the date picker experience in InputTimeInterval and QueryOptions by (1) replacing native <input type="date"> elements with BootstrapVue b-form-datepicker components, (2) adding previous/next day shift buttons to the range picker, and (3) wiring the existing startOfWeek user preference to the datepicker's start-weekday prop via a new get_first_day_of_week utility in src/util/time.ts.

Key changes:

  • src/util/time.ts — new get_first_day_of_week(startOfWeek) maps the three supported string values ('Sunday', 'Monday', 'Saturday') to BootstrapVue 2's 0-based numeric start-weekday indices; fallback is 1 (Monday), consistent with the store default.
  • src/components/InputTimeInterval.vue — replaces raw date inputs with b-form-datepicker, adds flanking / arrow buttons that call shiftDays(±1), imports arrow-left/arrow-right icons, and applies :start-weekday + :min/:max constraints. The shiftDays method correctly guards against an empty start value.
  • src/components/QueryOptions.vue — adds startOfWeek state + firstDayOfWeek computed to the two existing datepickers, using the correct :start-weekday prop for BootstrapVue 2 (^2.15.0).

Concerns from prior review rounds appear to be addressed: :start-weekday (not :first-day-of-week) is used throughout, :min/:max constraints are present, and shiftDays has an early return when start is unset.

Confidence Score: 4/5

PR is safe to merge; all previously-flagged functional issues are resolved and no new logic bugs were found.

The core feature works correctly — the weekday mapping is accurate for BootstrapVue 2, min/max constraints are preserved, and edge-case guards (empty start) are in place. The remaining items are P2 style suggestions (type narrowing and potential layout overflow on narrow screens) that don't affect correctness in normal usage.

No files require special attention; src/components/InputTimeInterval.vue is the most complex change and warrants a quick UI test at narrower viewport widths.

Important Files Changed

Filename Overview
src/util/time.ts Adds get_first_day_of_week utility that maps the string startOfWeek setting to BootstrapVue 2's numeric start-weekday indices (0=Sunday, 1=Monday, 6=Saturday). Mapping is correct and fallback to 1 (Monday) is consistent with the store default.
src/components/InputTimeInterval.vue Replaces native <input type="date"> elements with BootstrapVue b-form-datepicker, adds previous/next day shift buttons, and wires startOfWeek via the new utility. Min/max constraints and the early-return guard in shiftDays are correctly in place. The two 300px-minimum-width datepickers plus flanking buttons in a flex td may overflow on narrower viewports.
src/components/QueryOptions.vue Adds startOfWeek state mapping and firstDayOfWeek computed to the existing two b-form-datepicker controls using the correct :start-weekday prop for BootstrapVue 2.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[User clicks ← or → button] --> B{start is set?}
    B -- No --> Z[return — no-op]
    B -- Yes --> C[shift start by n days]
    C --> D{end is set?}
    D -- Yes --> E[shift end by n days]
    D -- No --> F[applyRange]
    E --> F
    F --> G[mode = 'range' / duration = 0]
    G --> H[valueChanged]
    H --> I{emptyDaterange or invalidDaterange or daterangeTooLong?}
    I -- Yes --> Z2[no emit]
    I -- No --> J[emit 'input' with new range]
Loading

Reviews (3): Last reviewed commit: "feat: improve timeline datepickers" | Re-trigger Greptile

@nerumo nerumo force-pushed the master branch 2 times, most recently from cc80563 to 132fad3 Compare March 19, 2026 11:42
@ErikBjare
Copy link
Copy Markdown
Member

@greptileai review

nerumo added 2 commits March 26, 2026 07:50
- support start of week
- add next/previous day buttons
- support start of week
- add next/previous day buttons
@ErikBjare
Copy link
Copy Markdown
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