mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Fix warnings after chrono upgrade (#30165)
Some functions are now deprecated, so use the suggested ones and do a general cleanup of the affected lines of code.
This commit is contained in:
parent
838e0f598c
commit
bd2503ceac
2 changed files with 56 additions and 43 deletions
|
@ -783,11 +783,14 @@ fn max_day_in_month(year_num: i32, month_num: u32) -> Result<u32, ()> {
|
|||
|
||||
/// https://html.spec.whatwg.org/multipage/#week-number-of-the-last-day
|
||||
fn max_week_in_year(year: i32) -> u32 {
|
||||
match Utc.ymd(year as i32, 1, 1).weekday() {
|
||||
Weekday::Thu => 53,
|
||||
Weekday::Wed if is_leap_year(year) => 53,
|
||||
_ => 52,
|
||||
}
|
||||
Utc.with_ymd_and_hms(year as i32, 1, 1, 0, 0, 0)
|
||||
.earliest()
|
||||
.map(|date_time| match date_time.weekday() {
|
||||
Weekday::Thu => 53,
|
||||
Weekday::Wed if is_leap_year(year) => 53,
|
||||
_ => 52,
|
||||
})
|
||||
.unwrap_or(52)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue