8000 egui_extras: Enable setting DatePickerButton start and end year explicitly by zachbateman · Pull Request #7061 · emilk/egui · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

egui_extras: Enable setting DatePickerButton start and end year explicitly #7061

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

Merged
merged 3 commits into from
Jun 16, 2025

Conversation

zachbateman
Copy link
Contributor

Add the ability to set the DatePickerButton's start and end years via new start_year and end_year methods.

Continue to use the existing today - 100 years and today + 10 years behavior if a year is not specified.

Copy link

Preview available at https://egui-pr-preview.github.io/pr/7061-datepickeryears
Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.

Comment on lines 108 to 121

/// Set the start year for the date picker. (Default: None)
#[inline]
pub fn start_year(mut self, start_year: i32) -> Self {
self.start_year = Some(start_year);
self
}

/// Set the end year for the date picker. (Default: None)
#[inline]
pub fn end_year(mut self, end_year: i32) -> Self {
self.end_year = Some(end_year);
self
}
Copy link
Owner

Choose a reason for hiding this comment

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

I suggest you simplify this with a single call with a RangeInclusive. I suspect that if you set one, you want to set both.

You should also explain what it is for (the dropdown of years you can choose from)

@emilk emilk added feature New feature or request egui_extras labels Jun 15, 2025
@zachbateman
Copy link
Contributor Author

Thanks for the feedback, @emilk. That makes sense, and I've updated accordingly.

@emilk emilk merged commit 011e0d2 into emilk:main Jun 16, 2025
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
egui_extras feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Datepicker year range manual selection
2 participants
0