Fix the year in the current date view

This commit is contained in:
Savanni D'Gerinel 2024-01-09 08:10:02 -05:00
parent 0007522b26
commit 2c7666304a
2 changed files with 5 additions and 4 deletions

View File

@ -11,10 +11,11 @@ pub struct DatePrivate {
impl Default for DatePrivate { impl Default for DatePrivate {
fn default() -> Self { fn default() -> Self {
let date = chrono::Local::now().date_naive();
let year = date.year();
let date = date.with_year(year + 10000).unwrap();
Self { Self {
date: Rc::new(RefCell::new(IFC::from( date: Rc::new(RefCell::new(IFC::from(date))),
chrono::Local::now().date_naive().with_year(12023).unwrap(),
))),
label: Rc::new(RefCell::new(gtk::Label::new(None))), label: Rc::new(RefCell::new(gtk::Label::new(None))),
} }
} }

View File

@ -102,7 +102,7 @@ pub fn main() {
let now = Local::now(); let now = Local::now();
let state = State { let state = State {
date: IFC::from(now.date_naive().with_year(12023).unwrap()), date: IFC::from(now.date_naive().with_year(now.year() + 10000).unwrap()),
next_event: EVENTS.next_event(now.with_timezone(&Utc)).unwrap(), next_event: EVENTS.next_event(now.with_timezone(&Utc)).unwrap(),
events: EVENTS.yearly_events(now.year()).unwrap(), events: EVENTS.yearly_events(now.year()).unwrap(),
transit: Some(transit), transit: Some(transit),