Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start adding ISO8601 style time zone format to neo formatter #5298

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions components/datetime/src/neo_skeleton.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

use crate::options::components;
use crate::options::length;
use crate::time_zone::IsoMinutes;
use crate::time_zone::IsoSeconds;
#[cfg(feature = "experimental")]
use crate::time_zone::ResolvedNeoTimeZoneSkeleton;
use crate::DateTimeFormatterOptions;
Expand Down Expand Up @@ -759,6 +761,17 @@ impl From<NeoTimeZoneSkeleton> for NeoComponents {
}
}

/// Specification of an offset time zone display style.
pub enum OffsetTimeZoneStyle {
/// The localized GMT offset format, e.g., “GMT−8”.
ShortLocalizedGmt,
/// The ISO-8601-style offset format, e.g., “-0800”.
///
/// Use [`NeoSkeletonLength::Long`] to opt-in to the Unicode variant
/// that includes time separators, e.g., “-08:00”.
Iso8601(IsoMinutes, IsoSeconds),
}

/// Specification of the time zone display style.
///
/// Time zone names contribute a lot of data size. For resource-constrained
Expand Down Expand Up @@ -791,8 +804,8 @@ pub enum NeoTimeZoneStyle {
///
/// When unavailable, falls back to [`NeoTimeZoneStyle::Offset`].
SpecificNonLocation,
/// The offset from UTC format, e.g., “GMT−8”.
Offset,
/// The format showing an offset in hours, minutes, and/or seconds from UTC.
Offset(OffsetTimeZoneStyle),
}

/// A skeleton for formatting a time zone.
Expand Down
Loading