| Crates.io | egui-datepicker |
| lib.rs | egui-datepicker |
| version | 0.3.0 |
| created_at | 2021-10-18 12:33:14.245093+00 |
| updated_at | 2022-01-14 20:54:51.08685+00 |
| description | Adds date picker widget for egui gui library |
| homepage | |
| repository | https://github.com/Shadr/egui-datepicker |
| max_upload_size | |
| id | 466768 |
| size | 50,160 |
This library provide a simple date picker widget for egui with some customization. Checkout the gif to see widget in action!
Add egui-datepicker as dependency to your project
[dependencies]
egui-datepicker = "0.3"
Import necessary structs
use egui_datepicker::{DatePicker, Date, Utc};
or if you already include chrono in your project
use egui_datepicker::DatePicker;
use chrono::{Date, offset::Utc};
Add date field with selected time offset in app struct
struct MyApp {
date: Date<Utc>,
}
Add widget in update function
fn update(/*snip*/) {
/*snip*/
ui.add(DatePicker::new("datepicker-unique-id", &mut self.date));
/*snip*/
}
You can set first day of week to sunday with
DatePicker::new(/*snip*/).sunday_first(true)
Make popup window movable
DatePicker::new(/*snip*/).movable(true)
Set different date format
DatePicker::new(/*snip*/).date_format("%d/%m/%Y")
egui-datepicker is licensed under MIT OR Apache-2.0