Skip to content

Commit

Permalink
Apply review
Browse files Browse the repository at this point in the history
  • Loading branch information
jedel1043 committed Feb 2, 2024
1 parent bd6c73f commit 186af9b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions time/src/offset_date_time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use deranged::RangedI64;
use num_conv::prelude::*;
use powerfmt::ext::FormatterExt as _;
use powerfmt::smart_display::{self, FormatterOptions, Metadata, SmartDisplay};
use time_core::convert::{Day, Hour, Minute, Nanosecond, Second};
use time_core::convert::*;

use crate::date::{MAX_YEAR, MIN_YEAR};
#[cfg(feature = "formatting")]
Expand Down Expand Up @@ -1596,7 +1596,6 @@ impl From<js_sys::Date> for OffsetDateTime {
///
/// This may panic if the timestamp can not be represented.
fn from(js_date: js_sys::Date) -> Self {
use time_core::convert::Millisecond;
// get_time() returns milliseconds
let timestamp_nanos = (js_date.get_time() * Nanosecond::per(Millisecond) as f64) as i128;
Self::from_unix_timestamp_nanos(timestamp_nanos)
Expand All @@ -1611,7 +1610,6 @@ impl From<js_sys::Date> for OffsetDateTime {
))]
impl From<OffsetDateTime> for js_sys::Date {
fn from(datetime: OffsetDateTime) -> Self {
use time_core::convert::Millisecond;
// new Date() takes milliseconds
let timestamp = (datetime.unix_timestamp_nanos()
/ Nanosecond::per(Millisecond).cast_signed().extend::<i128>())
Expand Down
2 changes: 1 addition & 1 deletion time/src/sys/local_offset_at/wasm_js.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use num_conv::{CastSigned, Extend};
use num_conv::prelude::*;

use crate::convert::*;
use crate::{OffsetDateTime, UtcOffset};
Expand Down

0 comments on commit 186af9b

Please sign in to comment.