Skip to content

Commit

Permalink
0.3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
victorteokw committed Nov 22, 2024
1 parent 37c310a commit b064b06
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 15 deletions.
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@teodevgroup/teo",
"version": "0.3.2",
"version": "0.3.4",
"main": "index.js",
"types": "index.d.ts",
"napi": {
Expand Down
8 changes: 2 additions & 6 deletions src/object/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,8 @@ pub fn js_any_to_teo_value(any: JsUnknown, env: Env) -> Result<Value> {
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::<Utc>::from_utc(naive, Utc))
let rust_date = DateTime::<Utc>::from_timestamp_millis(milliseconds_since_epoch_utc).unwrap();
TeoValue::DateTime(rust_date)
} else {
let object = any.coerce_to_object()?;
// test for decimal
Expand Down

0 comments on commit b064b06

Please sign in to comment.