pub struct TimezoneHandler { /* private fields */ }Expand description
Handler for timezone operations.
Implementations§
Source§impl TimezoneHandler
impl TimezoneHandler
Sourcepub fn new(config: TimezoneConfig) -> Result<Self, TimezoneError>
pub fn new(config: TimezoneConfig) -> Result<Self, TimezoneError>
Creates a new timezone handler from configuration.
Sourcepub fn us_eastern() -> Self
pub fn us_eastern() -> Self
Creates a handler with default US Eastern timezone.
Sourcepub fn get_entity_timezone(&self, entity_code: &str) -> Tz
pub fn get_entity_timezone(&self, entity_code: &str) -> Tz
Gets the timezone for a specific entity code.
Matches entity code against patterns in this order:
- Exact match
- Prefix patterns (e.g., “EU_*”)
- Suffix patterns (e.g., “*_APAC”)
- Default timezone
Sourcepub fn to_utc(&self, local: NaiveDateTime, entity_code: &str) -> DateTime<Utc>
pub fn to_utc(&self, local: NaiveDateTime, entity_code: &str) -> DateTime<Utc>
Converts a local datetime to UTC for a specific entity.
Sourcepub fn to_local(&self, utc: DateTime<Utc>, entity_code: &str) -> NaiveDateTime
pub fn to_local(&self, utc: DateTime<Utc>, entity_code: &str) -> NaiveDateTime
Converts a UTC datetime to local time for a specific entity.
Sourcepub fn to_consolidation(
&self,
local: NaiveDateTime,
entity_code: &str,
) -> DateTime<Tz>
pub fn to_consolidation( &self, local: NaiveDateTime, entity_code: &str, ) -> DateTime<Tz>
Converts a local datetime to the consolidation timezone.
Sourcepub fn consolidation_timezone(&self) -> Tz
pub fn consolidation_timezone(&self) -> Tz
Returns the consolidation timezone.
Sourcepub fn default_timezone(&self) -> Tz
pub fn default_timezone(&self) -> Tz
Returns the default timezone.
Sourcepub fn get_timezone_name(&self, entity_code: &str) -> String
pub fn get_timezone_name(&self, entity_code: &str) -> String
Returns the timezone name for an entity.
Sourcepub fn get_utc_offset_hours(&self, entity_code: &str, at: NaiveDateTime) -> f64
pub fn get_utc_offset_hours(&self, entity_code: &str, at: NaiveDateTime) -> f64
Calculates the UTC offset in hours for an entity at a given time.
Sourcepub fn config(&self) -> &TimezoneConfig
pub fn config(&self) -> &TimezoneConfig
Returns a reference to the underlying configuration.
Trait Implementations§
Source§impl Clone for TimezoneHandler
impl Clone for TimezoneHandler
Source§fn clone(&self) -> TimezoneHandler
fn clone(&self) -> TimezoneHandler
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TimezoneHandler
impl RefUnwindSafe for TimezoneHandler
impl Send for TimezoneHandler
impl Sync for TimezoneHandler
impl Unpin for TimezoneHandler
impl UnwindSafe for TimezoneHandler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more