pub enum Zone {
Utc,
Offset(i32),
Abbreviation {
name: String,
offset: i32,
dst: bool,
},
Named(TimeZone),
}Expand description
A time zone, in the three forms PHP has: an identifier, an abbreviation and a fixed offset.
The variants are open so that they can be matched. When building one by hand, prefer Zone::parse or the
From<jiff::tz::TimeZone> conversion: an offset out of range is only reported when a PhpDateTime is built.
Variants§
Utc
UTC.
Offset(i32)
A fixed offset, in seconds east of UTC: +02:00. Jiff accepts up to ±25:59:59.
Abbreviation
An abbreviation: EST, CEST, Z.
Fields
Named(TimeZone)
A zone with its own rules: an IANA identifier such as Europe/Madrid. A jiff zone that has rules but no name
(a POSIX TZ string, some system zones) is kept here too, and e prints its offset.
Implementations§
Source§impl Zone
impl Zone
Sourcepub fn parse(text: &str) -> Option<Self>
pub fn parse(text: &str) -> Option<Self>
Read a zone the way new DateTimeZone($text) does: an identifier (Europe/Madrid, in any letter case), an
abbreviation (EST, CEST, a short list) or an offset (+02:00, +0200, +02, GMT+2, with GMT in
capitals). Files of the time zone database that PHP does not take as identifiers (posixrules, localtime,
posix/..., right/..., SystemV/...) are rejected.
Returns None when text is not entirely a zone.
Trait Implementations§
impl Eq for Zone
Source§impl From<TimeZone> for Zone
impl From<TimeZone> for Zone
Source§fn from(zone: TimeZone) -> Self
fn from(zone: TimeZone) -> Self
UTC for jiff’s UTC, Zone::Offset for an unnamed fixed offset and Zone::Named for a zone with a name
or with rules of its own.
impl StructuralPartialEq for Zone
Auto Trait Implementations§
impl Forget for Zone
impl Freeze for Zone
impl Move for Zone
impl RefUnwindSafe for Zone
impl Send for Zone
impl Sync for Zone
impl Unpin for Zone
impl UnsafeUnpin for Zone
impl UnwindSafe for Zone
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.