From b064b06e8dc659830ff59184c26121201c727236 Mon Sep 17 00:00:00 2001 From: Victor Teo Date: Fri, 22 Nov 2024 14:51:54 +0800 Subject: [PATCH] 0.3.4 --- Cargo.lock | 10 +++++----- Cargo.toml | 6 +++--- package.json | 2 +- src/object/mod.rs | 8 ++------ 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b9739ef..d3d1d83 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3773,9 +3773,9 @@ dependencies = [ [[package]] name = "teo" -version = "0.3.2" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d27ae60a06710260eb8e26066dff8efed7e8387780697f38b52fba43c66dd2cb" +checksum = "6ad57f4c61c26c2dc816a1e3b16e6885078d730b499567c656ff082ead030e76" dependencies = [ "array_tool", "async-recursion", @@ -3908,9 +3908,9 @@ dependencies = [ [[package]] name = "teo-result" -version = "0.3.0" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eaa2df0ddecac4065165393b944b81592720a8aa90f3ffca447db0fc5c00fba" +checksum = "1df319ec6bc6554b24a0e21e2b173d99100c933072934035ee137958d316ce29" dependencies = [ "indexmap 2.6.0", "multer", @@ -3999,7 +3999,7 @@ dependencies = [ [[package]] name = "teodevgroup_teo" -version = "0.3.2" +version = "0.3.4" dependencies = [ "bigdecimal", "bson", diff --git a/Cargo.toml b/Cargo.toml index 7350f0d..3d5e9da 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,14 +1,14 @@ [package] edition = "2021" name = "teodevgroup_teo" -version = "0.3.2" +version = "0.3.4" [lib] crate-type = ["cdylib"] [dependencies] -teo = { version = "0.3.2" } -teo-result = { version = "0.3.0", features = ["napi"] } +teo = { version = "0.3.4" } +teo-result = { version = "0.3.4", features = ["napi"] } napi = { version = "2.16.13", default-features = false, features = ["napi5", "async", "chrono_date", "compat-mode"] } napi-derive = "2.16.12" chrono = { version = "0.4.31" } diff --git a/package.json b/package.json index 1dafee9..1477835 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@teodevgroup/teo", - "version": "0.3.2", + "version": "0.3.4", "main": "index.js", "types": "index.d.ts", "napi": { diff --git a/src/object/mod.rs b/src/object/mod.rs index c291e5b..788bea9 100644 --- a/src/object/mod.rs +++ b/src/object/mod.rs @@ -58,12 +58,8 @@ pub fn js_any_to_teo_value(any: JsUnknown, env: Env) -> Result { let js_date = JsDate::try_from(any)?; let milliseconds_since_epoch_utc = js_date.value_of()?; let milliseconds_since_epoch_utc = milliseconds_since_epoch_utc as i64; - let timestamp_seconds = milliseconds_since_epoch_utc / 1_000; - let naive = NaiveDateTime::from_timestamp_opt( - timestamp_seconds, - (milliseconds_since_epoch_utc % 1_000 * 1_000_000) as u32, - ).unwrap(); - TeoValue::DateTime(DateTime::::from_utc(naive, Utc)) + let rust_date = DateTime::::from_timestamp_millis(milliseconds_since_epoch_utc).unwrap(); + TeoValue::DateTime(rust_date) } else { let object = any.coerce_to_object()?; // test for decimal