Skip to content

Commit

Permalink
Revert default for OffsetHour modifier
Browse files Browse the repository at this point in the history
The values was mistakenly changed and was originally `false`. This
change brings behavior in line with parsing the component.
  • Loading branch information
jhpratt committed Sep 24, 2023
1 parent 6248992 commit 9abaf30
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions time/src/format_description/modifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
6 changes: 5 additions & 1 deletion time/src/serde/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())),
Expand Down

0 comments on commit 9abaf30

Please sign in to comment.