From 06451034663e7f17d0de5d1497bbf0d871292fae Mon Sep 17 00:00:00 2001 From: philipp Date: Mon, 2 Sep 2024 09:23:09 +0300 Subject: [PATCH] cox -> show next year staring from december --- src/model/user.rs | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/model/user.rs b/src/model/user.rs index 49d828c..c61459c 100644 --- a/src/model/user.rs +++ b/src/model/user.rs @@ -885,12 +885,26 @@ ORDER BY last_access DESC //december //has 31 //days - end_of_year + let days_left_in_year = end_of_year .signed_duration_since(Local::now().date_naive()) .num_days() - + 1 + + 1; + + if days_left_in_year < 30 { + let end_of_next_year = + NaiveDate::from_ymd_opt(Local::now().year() + 1, 12, 31).unwrap(); //Ok, + //december + //has 31 + //days + end_of_next_year + .signed_duration_since(Local::now().date_naive()) + .num_days() + + 1 + } else { + days_left_in_year + } } else { - 6 + 10 } }