refactor(common_utils): move serde implementations and date-time utils to common_utils crate (#40)

This commit is contained in:
Sanchith Hegde
2022-11-30 12:23:04 +05:30
committed by GitHub
parent 595f34e20f
commit 863e53c0d1
32 changed files with 189 additions and 192 deletions

View File

@ -13,5 +13,17 @@
)]
#![doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR" ), "/", "README.md"))]
pub mod custom_serde;
pub mod errors;
pub mod ext_traits;
/// Date-time utilities.
pub mod date_time {
use time::{OffsetDateTime, PrimitiveDateTime};
/// Create a new [`PrimitiveDateTime`] with the current date and time in UTC.
pub fn now() -> PrimitiveDateTime {
let utc_date_time = OffsetDateTime::now_utc();
PrimitiveDateTime::new(utc_date_time.date(), utc_date_time.time())
}
}