Skip to content

fix(dates): date_range default respects a single supplied bound - #10649

Merged
Light2Dark merged 1 commit into
marimo-team:mainfrom
winklemad:fix/date-range-single-bound-default
Sep 10, 2026
Merged

Light2Dark merged 1 commit into
marimo-team:mainfrom
winklemad:fix/date-range-single-bound-default

Conversation

@winklemad

Copy link
Copy Markdown
Contributor

This pull request was authored by a coding agent.

📝 Summary

Closes #10648

mo.ui.date_range derived its default value differently from mo.ui.date / mo.ui.datetime: when only one of start/stop was given (and no explicit value), it fell back to (today, today) and ignored the supplied bound, so the widget initialized outside its own declared range, and the None-value path skipped bounds validation.

This clamps the default to the supplied bound, matching the siblings — start=X → (X, X), stop=Y → (Y, Y), both given → (start, stop), neither → (today, today).

📋 Pre-Review Checklist

  • I have discussed large / public-API changes via an issue — n/a, small bug fix.
  • Any AI-generated code has been reviewed line-by-line by me and I stand by it.

✅ Merge Checklist

  • I have read the contributor guidelines.
  • Docstring updated to describe the default derivation.
  • Tests added (in-range default for start-only and stop-only).

@vercel

vercel Bot commented Aug 25, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
marimo-docs Ready Ready Preview Sep 4, 2026 8:12pm UTC

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes mo.ui.date_range default value derivation so that when value is omitted and only one bound is provided, the widget initializes within its declared bounds (matching mo.ui.date / mo.ui.datetime behavior).

Changes:

  • Adjust date_range defaulting logic: start=X → (X, X), stop=Y → (Y, Y), both bounds → (start, stop), neither → (today, today).
  • Ensure bounds validation runs for the derived default (not just user-supplied value).
  • Add regression tests for start-only and stop-only default behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
marimo/_plugins/ui/_impl/dates.py Updates date_range default-value derivation and documents the new defaulting rules.
tests/_plugins/ui/_impl/test_dates.py Adds tests to cover single-bound default behavior for date_range.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread marimo/_plugins/ui/_impl/dates.py Resolved
@kirangadhave
kirangadhave marked this pull request as ready for review August 31, 2026 21:01
@kirangadhave kirangadhave added the bug Something isn't working label Aug 31, 2026
When only one of start/stop was given without an explicit value,
date_range fell back to (today, today), which can violate the declared
[start, stop] range, and it skipped bounds validation on that path. Mirror
the date/datetime siblings by clamping the default to the supplied bound
and run bounds validation for the derived default too.
@Light2Dark
Light2Dark merged commit 0336d5c into marimo-team:main Sep 10, 2026
40 checks passed

This branch was successfully deployed

1 active deployment
Preview — 307714a9 Deployed Sep 4, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mo.ui.date_range default value can fall outside its declared start/stop range

4 participants