Skip to content

Add opportunity to represent chrono::NaiveDateTime in milliseconds. #670

@olvyko

Description

@olvyko

Juniper gives you the opportunity to use chrono::NaiveDateTime but I didn't find a way to represent timestamp in milliseconds.

https://docs.rs/chrono/0.4.11/chrono/naive/serde/index.html
https://docs.rs/chrono/0.4.11/chrono/serde/index.html

At the moment, using serde, I can do this:

use serde::Serialize;
use chrono::naive::serde::ts_milliseconds;

#[derive(Serialize)]
pub struct Example {
    #[serde(with = "ts_milliseconds")]
    pub timestamp: NaiveDateTime,
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions