From b447e63a9fff8d6b458ce81881e981cf5e8a0ece Mon Sep 17 00:00:00 2001 From: "Shane F. Carr" Date: Thu, 19 Dec 2024 17:18:44 -0800 Subject: [PATCH] fixes --- components/datetime/src/scaffold/calendar.rs | 9 ++++++--- ffi/capi/src/zoned_formatter.rs | 14 +++++++------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/components/datetime/src/scaffold/calendar.rs b/components/datetime/src/scaffold/calendar.rs index 3886a73a15e..6996e960862 100644 --- a/components/datetime/src/scaffold/calendar.rs +++ b/components/datetime/src/scaffold/calendar.rs @@ -514,13 +514,16 @@ impl InSameCalendar for TimeZoneInfo { /// An input associated with a fixed, static calendar. pub trait InFixedCalendar {} -impl> InFixedCalendar for Date {} +impl> InFixedCalendar for Date {} impl InFixedCalendar for Time {} -impl> InFixedCalendar for DateTime {} +impl> InFixedCalendar for DateTime {} -impl, Z> InFixedCalendar for CustomZonedDateTime {} +impl, Z> InFixedCalendar + for CustomZonedDateTime +{ +} impl InFixedCalendar for UtcOffset {} diff --git a/ffi/capi/src/zoned_formatter.rs b/ffi/capi/src/zoned_formatter.rs index a0187efa1f9..241ec879216 100644 --- a/ffi/capi/src/zoned_formatter.rs +++ b/ffi/capi/src/zoned_formatter.rs @@ -7,7 +7,7 @@ #[diplomat::attr(auto, namespace = "icu4x")] pub mod ffi { use alloc::boxed::Box; - use icu_datetime::fieldsets::YMDTV; + use icu_datetime::fieldsets::{Combo, Vs, YMDT}; #[cfg(any(feature = "compiled_data", feature = "buffer_provider"))] use icu_datetime::options::Length; use icu_timezone::ZoneVariant; @@ -32,7 +32,7 @@ pub mod ffi { /// An object capable of formatting a date time with time zone to a string. #[diplomat::rust_link(icu::datetime, Mod)] pub struct GregorianZonedDateTimeFormatter( - pub icu_datetime::FixedCalendarDateTimeFormatter, + pub icu_datetime::FixedCalendarDateTimeFormatter>, ); impl GregorianZonedDateTimeFormatter { @@ -48,7 +48,7 @@ pub mod ffi { length: DateTimeLength, ) -> Result, DateTimeFormatterLoadError> { let prefs = (&locale.0).into(); - let options = YMDTV::with_length(Length::from(length)); + let options = YMDT::with_length(Length::from(length)).with_zone_generic(); Ok(Box::new(GregorianZonedDateTimeFormatter( icu_datetime::FixedCalendarDateTimeFormatter::try_new(prefs, options)?, @@ -66,7 +66,7 @@ pub mod ffi { length: DateTimeLength, ) -> Result, DateTimeFormatterLoadError> { let prefs = (&locale.0).into(); - let options = YMDTV::with_length(Length::from(length)); + let options = YMDT::with_length(Length::from(length)).with_zone_generic(); Ok(Box::new(GregorianZonedDateTimeFormatter( provider.call_constructor_custom_err(move |provider| { @@ -101,7 +101,7 @@ pub mod ffi { #[diplomat::opaque] /// An object capable of formatting a date time with time zone to a string. #[diplomat::rust_link(icu::datetime, Mod)] - pub struct ZonedDateTimeFormatter(pub icu_datetime::DateTimeFormatter); + pub struct ZonedDateTimeFormatter(pub icu_datetime::DateTimeFormatter>); impl ZonedDateTimeFormatter { /// Creates a new [`ZonedDateTimeFormatter`] from locale data using compiled data. @@ -116,7 +116,7 @@ pub mod ffi { length: DateTimeLength, ) -> Result, DateTimeFormatterLoadError> { let prefs = (&locale.0).into(); - let options = YMDTV::with_length(Length::from(length)); + let options = YMDT::with_length(Length::from(length)).with_zone_generic(); Ok(Box::new(ZonedDateTimeFormatter( icu_datetime::DateTimeFormatter::try_new(prefs, options)?, @@ -134,7 +134,7 @@ pub mod ffi { length: DateTimeLength, ) -> Result, DateTimeFormatterLoadError> { let prefs = (&locale.0).into(); - let options = YMDTV::with_length(Length::from(length)); + let options = YMDT::with_length(Length::from(length)).with_zone_generic(); Ok(Box::new(ZonedDateTimeFormatter( provider.call_constructor_custom_err(move |provider| {