Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: mo.ui.datetime, mo.ui.date_range #2174

Merged
merged 3 commits into from
Aug 30, 2024
Merged

feat: mo.ui.datetime, mo.ui.date_range #2174

merged 3 commits into from
Aug 30, 2024

Conversation

mscolnick
Copy link
Contributor

@mscolnick mscolnick commented Aug 30, 2024

This adds mo.ui.datetime and mo.ui.date_range


start_datetime = mo.ui.datetime(
    label="Start datetime",
    start=datetime.datetime(2021, 1, 1),
    stop=datetime.datetime(2021, 12, 31),
)
end_datetime = mo.ui.datetime(
    label="End datetime",
    start=datetime.datetime(2021, 1, 1),
    stop=datetime.datetime(2021, 12, 31),
)

mo.hstack(
    [
        mo.hstack([start_datetime, "➡️", end_datetime]).left(),
        mo.md(f"From {start_datetime.value} to {end_datetime.value}"),
    ]
)
date_range_input = mo.ui.date_range(
    label="Date_range",
    start=datetime.date(2021, 1, 1),
    stop=datetime.date(2021, 12, 31),
)


mo.hstack([date_range_input, date_range_input.value])

Copy link

vercel bot commented Aug 30, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
marimo-docs ❌ Failed (Inspect) Aug 30, 2024 7:17pm
marimo-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 30, 2024 7:17pm

akshayka
akshayka previously approved these changes Aug 30, 2024
Copy link
Contributor

@akshayka akshayka left a comment

Choose a reason for hiding this comment

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

LGTM except for two small comments

Comment on lines +210 to +212
label: Optional[str] = None,
on_change: Optional[Callable[[Optional[dt.datetime]], None]] = None,
full_width: bool = False,
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's make these keyword only, similar to mo.ui.date

Comment on lines +338 to +340
label: Optional[str] = None,
on_change: Optional[Callable[[Tuple[dt.date, dt.date]], None]] = None,
full_width: bool = False,
Copy link
Contributor

Choose a reason for hiding this comment

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

These should also be keyword-only

Copy link

🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.8.8-dev7

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