Skip to content

Commit

Permalink
Bubble parts through FormattedUnit into FormattedDuration
Browse files Browse the repository at this point in the history
  • Loading branch information
sffc committed Dec 17, 2024
1 parent d04b9fa commit 2804e85
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions components/experimental/src/dimension/units/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ pub struct FormattedUnit<'l> {
}

impl Writeable for FormattedUnit<'_> {
fn write_to<W>(&self, sink: &mut W) -> core::result::Result<(), core::fmt::Error>
fn write_to_parts<W>(&self, sink: &mut W) -> core::result::Result<(), core::fmt::Error>
where
W: core::fmt::Write + ?Sized,
W: writeable::PartsWrite + ?Sized,
{
self.display_name
.patterns
.get(self.value.into(), self.plural_rules)
.interpolate((self.fixed_decimal_formatter.format(self.value),))
.write_to(sink)
.write_to_parts(sink)
}
}

Expand Down
4 changes: 4 additions & 0 deletions components/experimental/src/duration/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -710,12 +710,16 @@ mod tests {
[
(0, 6, parts::YEAR),
(0, 6, icu_list::parts::ELEMENT),
(0, 1, icu_decimal::parts::MINUS_SIGN),
(1, 2, icu_decimal::parts::INTEGER),
(6, 8, icu_list::parts::LITERAL),
(8, 14, parts::MONTH),
(8, 14, icu_list::parts::ELEMENT),
(8, 9, icu_decimal::parts::INTEGER),
(14, 16, icu_list::parts::LITERAL),
(16, 21, parts::WEEK),
(16, 21, icu_list::parts::ELEMENT),
(16, 17, icu_decimal::parts::INTEGER),
(21, 23, icu_list::parts::LITERAL),
(23, 37, icu_list::parts::ELEMENT),
(23, 25, icu_decimal::parts::INTEGER),
Expand Down

0 comments on commit 2804e85

Please sign in to comment.