2

I'm trying to use chrono crate from substrate chrono docs when implementing a ink! smart contract.

I've just imported chrono::DateTime and chrono::Utc from the crate and can compile and run test.

However I get errors when trying to build the contract with cargo +nightly contract build:

doesn't have a size known at compile-time

Do you know what I'm missing? Is there a better/standard way to handle dates and timestamps?

2
  • Can you please add the line of your Cargo.toml where you import the crate to your question? Commented May 2, 2022 at 9:31
  • I found that changing from chrono = "0.4" to chrono = { version = "0.4", default-features = false } solved the issue
    – mastro
    Commented May 2, 2022 at 9:47

1 Answer 1

1

changing from

[dependencies]
chrono = "0.4" 

to

[dependencies]
chrono = { version = "0.4", default-features = false }

in Cargo.toml solved the issue

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.