diff --git a/time/src/format_description/modifier.rs b/time/src/format_description/modifier.rs index b145e60cc..3a57bb6f6 100644 --- a/time/src/format_description/modifier.rs +++ b/time/src/format_description/modifier.rs @@ -392,10 +392,10 @@ impl_const_default! { /// Creates a modifier that indicates the stringified value contains [one or more /// digits](SubsecondDigits::OneOrMore). @pub Subsecond => Self { digits: SubsecondDigits::OneOrMore }; - /// Creates a modifier that indicates the value uses the `+` sign for all positive values - /// and is [padded with zeroes](Padding::Zero). + /// Creates a modifier that indicates the value only uses a sign for negative values and is + /// [padded with zeroes](Padding::Zero). @pub OffsetHour => Self { - sign_is_mandatory: true, + sign_is_mandatory: false, padding: Padding::Zero, }; /// Creates a modifier that indicates the value is [padded with zeroes](Padding::Zero). diff --git a/time/src/serde/mod.rs b/time/src/serde/mod.rs index 7e3403fb3..f94cf0445 100644 --- a/time/src/serde/mod.rs +++ b/time/src/serde/mod.rs @@ -403,7 +403,11 @@ impl<'a> Deserialize<'a> for Time { /// The format used when serializing and deserializing a human-readable `UtcOffset`. #[cfg(feature = "parsing")] const UTC_OFFSET_FORMAT: &[FormatItem<'_>] = &[ - FormatItem::Component(Component::OffsetHour(modifier::OffsetHour::default())), + FormatItem::Component(Component::OffsetHour({ + let mut m = modifier::OffsetHour::default(); + m.sign_is_mandatory = true; + m + })), FormatItem::Optional(&FormatItem::Compound(&[ FormatItem::Literal(b":"), FormatItem::Component(Component::OffsetMinute(modifier::OffsetMinute::default())),