Skip to content

Commit

Permalink
Correct H23 as the stored symbol for skeletons
Browse files Browse the repository at this point in the history
  • Loading branch information
gregtatum committed Jul 2, 2021
1 parent 4c6f00c commit dc73213
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion components/datetime/src/pattern/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ impl Serialize for Pattern {
}

/// Used to represent either H11/H12, or H23/H24. Skeletons only store these
/// hour cycles as H12 or H24.
/// hour cycles as H12 or H23.
#[derive(Debug, PartialEq, Clone, Copy)]
#[cfg_attr(
feature = "provider_serde",
Expand Down
2 changes: 1 addition & 1 deletion components/datetime/src/pattern/transform_hour_cycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub fn apply_coarse_hour_cycle(
// Mutate the pattern with the new symbol, so that it can be matched against.
*symbol = fields::FieldSymbol::Hour(match coarse_hour_cycle {
CoarseHourCycle::H11H12 => fields::Hour::H12,
CoarseHourCycle::H23H24 => fields::Hour::H24,
CoarseHourCycle::H23H24 => fields::Hour::H23,
});
break;
}
Expand Down
4 changes: 2 additions & 2 deletions components/datetime/src/skeleton.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,13 @@ impl From<&Pattern> for Skeleton {
// FieldSymbol::DayPeriod(fields::DayPeriod::Flexible)
// }

// Only the H12 and H24 symbols are used in skeletons, while the patterns may
// Only the H12 and H23 symbols are used in skeletons, while the patterns may
// contain H11 or H23 depending on the localization.
FieldSymbol::Hour(fields::Hour::H11) | FieldSymbol::Hour(fields::Hour::H12) => {
FieldSymbol::Hour(fields::Hour::H12)
}
FieldSymbol::Hour(fields::Hour::H23) | FieldSymbol::Hour(fields::Hour::H24) => {
FieldSymbol::Hour(fields::Hour::H24)
FieldSymbol::Hour(fields::Hour::H23)
}

// Pass through all of the following preferences unchanged.
Expand Down

0 comments on commit dc73213

Please sign in to comment.