From 0768bba5b9077e375f850bd917611f01ff7cdd4b Mon Sep 17 00:00:00 2001 From: Azhar Ismagulova <31756707+azharcodeit@users.noreply.github.com> Date: Fri, 8 Mar 2024 16:47:09 +0000 Subject: [PATCH] fix: resolved warnings related to deprecated method chrono::NaiveDateTime::timestamp_millis (#31584) --- components/script/dom/htmlinputelement.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index 994691d956f..16b57c8de34 100755 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -1327,7 +1327,7 @@ impl HTMLInputElementMethods for HTMLInputElement { self.convert_string_to_naive_datetime(self.Value()) .map(|dt| unsafe { let time = ClippedTime { - t: dt.timestamp_millis() as f64, + t: dt.and_utc().timestamp_millis() as f64, }; NonNull::new_unchecked(NewDateObject(*cx, time)) }) @@ -2145,7 +2145,7 @@ impl HTMLInputElement { .ok() .and_then(|(year, month, day)| NaiveDate::from_ymd_opt(year, month, day)) .and_then(|date| date.and_hms_opt(0, 0, 0)) - .map(|time| Ok(time.timestamp_millis() as f64)) + .map(|time| Ok(time.and_utc().timestamp_millis() as f64)) .unwrap_or(Err(())), InputType::Month => match value.parse_month_string() { // This one returns number of months, not milliseconds @@ -2160,7 +2160,7 @@ impl HTMLInputElement { .ok() .and_then(|(year, weeknum)| NaiveDate::from_isoywd_opt(year, weeknum, Weekday::Mon)) .and_then(|date| date.and_hms_opt(0, 0, 0)) - .map(|time| Ok(time.timestamp_millis() as f64)) + .map(|time| Ok(time.and_utc().timestamp_millis() as f64)) .unwrap_or(Err(())), InputType::Time => match value.parse_time_string() { Ok((hours, minutes, seconds)) => { @@ -2178,7 +2178,7 @@ impl HTMLInputElement { (seconds + 60.0 * minutes as f64 + 3600.0 * hours as f64) * 1000.0; NaiveDate::from_ymd_opt(year, month, day) .and_then(|date| date.and_hms_opt(0, 0, 0)) - .map(|time| Ok(time.timestamp_millis() as f64 + hms_millis)) + .map(|time| Ok(time.and_utc().timestamp_millis() as f64 + hms_millis)) }) .unwrap_or(Err(())) },