refactor(time): update to icu 2.0.0
This commit is contained in:
parent
a795006633
commit
054cf4aca1
5 changed files with 720 additions and 731 deletions
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
use chrono::{Datelike, Days, NaiveDate, Weekday};
|
||||
|
||||
/// Gets the first date that will be visible on the calender
|
||||
pub fn get_calender_first(year: i32, month: u32, from_weekday: Weekday) -> NaiveDate {
|
||||
/// Gets the first date that will be visible on the calendar
|
||||
pub fn get_calendar_first(year: i32, month: u32, from_weekday: Weekday) -> NaiveDate {
|
||||
let date = NaiveDate::from_ymd_opt(year, month, 1).unwrap();
|
||||
let num_days = (date.weekday() as u32 + 7 - from_weekday as u32) % 7; // chrono::Weekday.num_days_from
|
||||
date.checked_sub_days(Days::new(num_days as u64)).unwrap()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue