Skip to content

docs(InputDate): add date range filter example#6334

Open
onmax wants to merge 6 commits intonuxt:v4from
onmax:docs/input-date-range-filter
Open

docs(InputDate): add date range filter example#6334
onmax wants to merge 6 commits intonuxt:v4from
onmax:docs/input-date-range-filter

Conversation

@onmax
Copy link
Copy Markdown
Contributor

@onmax onmax commented Apr 10, 2026

Cap.2026-04-11.at.14.55.47.mp4

The left quick actions is vertically center now, it was not vertically center in the video

Mobile Dekstop
image image

Mobile

Old implementation

After this comment: #6334 (review)

This PR has completely changed. For future reference:

I just saw this https://x.com/steveschoger/status/2042272697283985610 (15:30) as well as in https://app.blacksmith.sh/quiverdk/runs/workflows. I find it quite useful, and really nice UX, so i think it would be nice to have that pattern ready to copy paste from the docs.

This PR:

  • Adds a new recipe example under InputDate showing a date range filter with button presets (1D, 3D, 7D, 14D, 30D) and a calendar popover for custom range selection
Cap.2026-04-10.at.17.22.46.mp4

TODO

  • use dropdown in mobile?

@onmax onmax requested a review from benjamincanac as a code owner April 10, 2026 15:23
@github-actions github-actions bot added the v4 #4488 label Apr 10, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 10, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Replaces fixed example dates with dynamic initialization using today(tz) (defaulting to a 14-day range ending today). Adds preset ranges (7, 14, 30 days; 3, 6 months; 1 year), helper functions to compute/apply presets and detect matches, and a computed label for button text formatted with a single timezone. Template changes to a two-pane popover: a left preset-button list (hidden on small screens) and a calendar that shows 2 months on desktop, 1 month on smaller screens. Documentation text updated to mention preset ranges in the Button+Popover example.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title mentions 'InputDate' and 'date range filter example', but the changes are actually to a Calendar component example, not InputDate. The title is misleading about which component is being modified. Update the title to accurately reflect the changes, such as 'docs(Calendar): add date range filter example with presets' to match the actual component being modified.
✅ Passed checks (2 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The PR description relates to the changeset by describing the calendar date range picker implementation with preset ranges, though it primarily consists of screenshots and references rather than detailed text explanation.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@docs/app/components/content/examples/input-date/InputDateDateRangeFilterExample.vue`:
- Around line 19-27: The preset ranges are off-by-one because you subtract the
full preset length when computing the inclusive start date; update the initial
dateRange and the selectPreset function to subtract (days - 1) for the start
date (i.e., use today(tz).subtract({ days: days - 1 }) and for the initial 7-day
preset subtract 6) so that 1D/3D/7D/etc. produce inclusive spans shown as start
– end; adjust selectPreset(dateRange) logic to handle days === 1 (subtract 0)
accordingly.

In `@docs/content/docs/2.components/input-date.md`:
- Around line 231-236: The MD003 lint error comes from the ::component-example
directive block for 'input-date-date-range-filter-example'; wrap that directive
with local markdownlint suppression comments to silence MD003 (add <!--
markdownlint-disable MD003 --> immediately before the ::component-example line
and <!-- markdownlint-enable MD003 --> immediately after the closing ::) so the
block remains unchanged but lint passes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b0e3b039-0835-4128-805e-ba0300318058

📥 Commits

Reviewing files that changed from the base of the PR and between aae5378 and b613022.

📒 Files selected for processing (2)
  • docs/app/components/content/examples/input-date/InputDateDateRangeFilterExample.vue
  • docs/content/docs/2.components/input-date.md

Comment thread docs/content/docs/2.components/input-date.md Outdated
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 10, 2026

npm i https://pkg.pr.new/@nuxt/ui@6334

commit: d451c05

Copy link
Copy Markdown
Member

@benjamincanac benjamincanac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@onmax Since this use Calendar component, I would put this inside calendar.md. We could also improve the As a date range picker example with this or with filters inside the popover like I did in the dashboard template:

Image

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@docs/app/components/content/examples/calendar/CalendarDateRangePickerExample.vue`:
- Around line 33-36: The isRangeSelected function assumes computeStart(range)
returns both start and end and calls .compare on them, which can throw when end
(or start) is unset during range picking; update isRangeSelected to guard
against missing values from computeStart and from modelValue.value (e.g., check
that start and end are non-null/defined before calling .compare or short-circuit
to false), referencing the computeStart(range), isRangeSelected,
modelValue.value, and ranges symbols so the comparison only runs when both
boundaries exist.
- Around line 17-18: Compute the end date once and derive start from it to avoid
a rollover race: call today(tz) a single time (e.g., assign to a local variable
named end) and then set start by subtracting 14 days from that end value; update
the CalendarDateRangePickerExample.vue example to use the single today(tz)
result rather than calling today(tz) twice for start and end.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8e1f40bd-8072-4b58-a727-adc9cb38c704

📥 Commits

Reviewing files that changed from the base of the PR and between 30025a1 and 221661c.

📒 Files selected for processing (2)
  • docs/app/components/content/examples/calendar/CalendarDateRangePickerExample.vue
  • docs/content/docs/2.components/calendar.md
✅ Files skipped from review due to trivial changes (1)
  • docs/content/docs/2.components/calendar.md

Comment thread docs/app/components/content/examples/calendar/CalendarDateRangePickerExample.vue Outdated
@onmax
Copy link
Copy Markdown
Contributor Author

onmax commented Apr 11, 2026

Hey @benjamincanac, I have updated the PR and also created a new video with your recommendation.

For mobile I have followed the same pattern and remove the quick-actions selector and just left one month input

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

Labels

v4 #4488

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants