mirror of
https://github.com/emilk/egui.git
synced 2026-09-02 06:40:06 -04:00
Chrono update (#2397)
* limit day to last day of month if the month or year is changed * update chrono to 0.4.23, switch to NaiveDate and remove use of deprecated functions.
This commit is contained in:
@@ -2,16 +2,16 @@ mod button;
|
||||
mod popup;
|
||||
|
||||
pub use button::DatePickerButton;
|
||||
use chrono::{Date, Datelike, Duration, NaiveDate, Utc, Weekday};
|
||||
use chrono::{Datelike, Duration, NaiveDate, Weekday};
|
||||
|
||||
#[derive(Debug)]
|
||||
struct Week {
|
||||
number: u8,
|
||||
days: Vec<Date<Utc>>,
|
||||
days: Vec<NaiveDate>,
|
||||
}
|
||||
|
||||
fn month_data(year: i32, month: u32) -> Vec<Week> {
|
||||
let first = Date::from_utc(NaiveDate::from_ymd(year, month, 1), Utc);
|
||||
let first = NaiveDate::from_ymd_opt(year, month, 1).expect("Could not create NaiveDate");
|
||||
let mut start = first;
|
||||
while start.weekday() != Weekday::Mon {
|
||||
start = start.checked_sub_signed(Duration::days(1)).unwrap();
|
||||
|
||||
Reference in New Issue
Block a user