mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 09:07:09 +08:00
fix: resolve TODO comments in storage models crate (#151)
This commit is contained in:
@ -24,12 +24,20 @@ pub mod validation;
|
||||
/// Date-time utilities.
|
||||
pub mod date_time {
|
||||
use time::{OffsetDateTime, PrimitiveDateTime};
|
||||
/// Struct to represent milliseconds in time sensitive data fields
|
||||
#[derive(Debug)]
|
||||
pub struct Milliseconds(i32);
|
||||
|
||||
/// 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())
|
||||
}
|
||||
|
||||
/// Convert from OffsetDateTime to PrimitiveDateTime
|
||||
pub fn convert_to_pdt(offset_time: OffsetDateTime) -> PrimitiveDateTime {
|
||||
PrimitiveDateTime::new(offset_time.date(), offset_time.time())
|
||||
}
|
||||
}
|
||||
|
||||
/// Generate a nanoid with the given prefix and length
|
||||
|
||||
Reference in New Issue
Block a user