Skip to content

Commit e62c043

Browse files
committed
Update call sites
1 parent 7bbad4b commit e62c043

20 files changed

+139
-126
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ icu = "1.5.0"
3737

3838
```rust
3939
use icu::calendar::DateTime;
40-
use icu::datetime::{DateTimeFormatter, NeoSkeletonLength, fieldset::NeoAutoDateTimeMarker};
40+
use icu::datetime::{DateTimeFormatter, NeoSkeletonLength, fieldset::YMDHMS};
4141
use icu::locale::locale;
4242

4343
let dtf = DateTimeFormatter::try_new(
4444
&locale!("es").into(),
45-
NeoAutoDateTimeMarker::with_length(NeoSkeletonLength::Long)
45+
YMDHMS::with_length(NeoSkeletonLength::Long)
4646
)
4747
.expect("locale should be present in compiled data");
4848

components/datetime/README.md

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/datetime/examples/work_log.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use icu_benchmark_macros::println;
1111

1212
use icu_calendar::{DateTime, Gregorian};
1313
use icu_datetime::{
14-
fieldset::NeoYearMonthDayHourMinuteMarker, neo_skeleton::NeoSkeletonLength,
14+
fieldset::YMDHM, neo_skeleton::NeoSkeletonLength,
1515
FixedCalendarDateTimeFormatter,
1616
};
1717
use icu_locale_core::locale;
@@ -32,7 +32,7 @@ const DATES_ISO: &[(i32, u8, u8, u8, u8, u8)] = &[
3232
fn main() {
3333
let dtf = FixedCalendarDateTimeFormatter::<Gregorian, _>::try_new(
3434
&locale!("en").into(),
35-
NeoYearMonthDayHourMinuteMarker::with_length(NeoSkeletonLength::Medium),
35+
YMDHM::with_length(NeoSkeletonLength::Medium),
3636
)
3737
.expect("Failed to create FixedCalendarDateTimeFormatter instance.");
3838

components/datetime/src/fieldset.rs

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ macro_rules! impl_marker_with_options {
138138
/// Internal helper macro used by [`impl_date_marker`] and [`impl_calendar_period_marker`]
139139
macro_rules! impl_date_or_calendar_period_marker {
140140
(
141+
$(#[$attr:meta])*
141142
// The name of the type being created.
142143
$type:ident,
143144
// A plain language description of the field set for documentation.
@@ -218,6 +219,7 @@ macro_rules! impl_date_or_calendar_period_marker {
218219
#[doc = concat!(" \"", $sample, "\"")]
219220
/// );
220221
/// ```
222+
$(#[$attr])*
221223
$type,
222224
sample_length: $sample_length,
223225
$(alignment: $option_alignment_yes,)?
@@ -278,6 +280,7 @@ macro_rules! impl_date_or_calendar_period_marker {
278280
/// See [`impl_date_marker`].
279281
macro_rules! impl_date_marker {
280282
(
283+
$(#[$attr:meta])*
281284
$type:ident,
282285
$components:expr,
283286
description = $description:literal,
@@ -296,6 +299,7 @@ macro_rules! impl_date_marker {
296299
$(option_alignment = $option_alignment_yes:ident,)?
297300
) => {
298301
impl_date_or_calendar_period_marker!(
302+
$(#[$attr])*
299303
$type,
300304
description = $description,
301305
sample_length = $sample_length,
@@ -330,6 +334,7 @@ macro_rules! impl_date_marker {
330334
/// See [`impl_date_marker`].
331335
macro_rules! impl_calendar_period_marker {
332336
(
337+
$(#[$attr:meta])*
333338
$type:ident,
334339
$components:expr,
335340
description = $description:literal,
@@ -344,6 +349,7 @@ macro_rules! impl_calendar_period_marker {
344349
$(option_alignment = $option_alignment_yes:ident,)?
345350
) => {
346351
impl_date_or_calendar_period_marker!(
352+
$(#[$attr])*
347353
$type,
348354
description = $description,
349355
sample_length = $sample_length,
@@ -371,6 +377,7 @@ macro_rules! impl_calendar_period_marker {
371377
/// Documentation for each option is shown inline below.
372378
macro_rules! impl_time_marker {
373379
(
380+
$(#[$attr:meta])*
374381
// The name of the type being created.
375382
$type:ident,
376383
// An expression for the field set.
@@ -443,6 +450,7 @@ macro_rules! impl_time_marker {
443450
#[doc = concat!(" \"", $sample, "\"")]
444451
/// );
445452
/// ```
453+
$(#[$attr])*
446454
$type,
447455
sample_length: $sample_length,
448456
alignment: yes,
@@ -783,11 +791,13 @@ macro_rules! impl_zoneddatetime_marker {
783791
}
784792

785793
impl_date_marker!(
794+
/// This format may use ordinal formatting, such as "the 17th",
795+
/// in the future. See CLDR-18040.
786796
D,
787797
NeoDateComponents::Day,
788798
description = "day of month (standalone)",
789799
sample_length = Short,
790-
sample = "the 17th",
800+
sample = "17",
791801
input_day_of_month = yes,
792802
input_any_calendar_kind = yes,
793803
option_alignment = yes,
@@ -804,11 +814,13 @@ impl_date_marker!(
804814
);
805815

806816
impl_date_marker!(
817+
/// This format may use ordinal formatting, such as "Friday the 17th",
818+
/// in the future. See CLDR-18040.
807819
DE,
808820
NeoDateComponents::DayWeekday,
809821
description = "day of month and weekday",
810822
sample_length = Long,
811-
sample = "Friday the 17th",
823+
sample = "17 Friday",
812824
weekdays = yes,
813825
input_day_of_month = yes,
814826
input_day_of_week = yes,
@@ -829,11 +841,12 @@ impl_date_marker!(
829841
);
830842

831843
impl_date_marker!(
844+
/// See CLDR-18040 for progress on improving this format.
832845
MDE,
833846
NeoDateComponents::MonthDayWeekday,
834847
description = "month, day, and weekday",
835848
sample_length = Medium,
836-
sample = "Friday, May 17",
849+
sample = "Fri, May 17",
837850
months = yes,
838851
weekdays = yes,
839852
input_month = yes,
@@ -1041,8 +1054,8 @@ impl_zone_marker!(
10411054
/// use icu::timezone::{TimeZoneInfo, CustomZonedDateTime};
10421055
/// use icu::calendar::Gregorian;
10431056
/// use icu::datetime::DateTimeFormatter;
1044-
/// use icu::datetime::fieldset::NeoMonthDayMarker;
1045-
/// use icu::datetime::fieldset::NeoHourMinuteMarker;
1057+
/// use icu::datetime::fieldset::MD;
1058+
/// use icu::datetime::fieldset::HM;
10461059
/// use icu::datetime::fieldset::NeoTimeZoneSpecificShortMarker;
10471060
/// use icu::datetime::DateTimeCombo;
10481061
/// use icu::datetime::neo_skeleton::NeoSkeletonLength;
@@ -1051,8 +1064,8 @@ impl_zone_marker!(
10511064
/// use writeable::assert_try_writeable_eq;
10521065
///
10531066
/// type MyDateTimeZoneSet = DateTimeCombo<
1054-
/// NeoMonthDayMarker,
1055-
/// NeoHourMinuteMarker,
1067+
/// MD,
1068+
/// HM,
10561069
/// NeoTimeZoneSpecificShortMarker,
10571070
/// >;
10581071
///
@@ -1313,8 +1326,8 @@ impl_zone_marker!(
13131326
/// use icu::timezone::{TimeZoneInfo, CustomZonedDateTime};
13141327
/// use icu::calendar::Gregorian;
13151328
/// use icu::datetime::DateTimeFormatter;
1316-
/// use icu::datetime::fieldset::NeoMonthDayMarker;
1317-
/// use icu::datetime::fieldset::NeoHourMinuteMarker;
1329+
/// use icu::datetime::fieldset::MD;
1330+
/// use icu::datetime::fieldset::HM;
13181331
/// use icu::datetime::fieldset::NeoTimeZoneGenericShortMarker;
13191332
/// use icu::datetime::DateTimeCombo;
13201333
/// use icu::datetime::neo_skeleton::NeoSkeletonLength;
@@ -1323,8 +1336,8 @@ impl_zone_marker!(
13231336
/// use writeable::assert_try_writeable_eq;
13241337
///
13251338
/// type MyDateTimeZoneSet = DateTimeCombo<
1326-
/// NeoMonthDayMarker,
1327-
/// NeoHourMinuteMarker,
1339+
/// MD,
1340+
/// HM,
13281341
/// NeoTimeZoneGenericShortMarker,
13291342
/// >;
13301343
///

components/datetime/src/format/datetime.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ where
556556
#[cfg(feature = "compiled_data")]
557557
mod tests {
558558
use super::*;
559-
use crate::{fieldset::NeoAutoDateMarker, neo_skeleton::NeoSkeletonLength, pattern::runtime};
559+
use crate::{fieldset::YMD, neo_skeleton::NeoSkeletonLength, pattern::runtime};
560560
use icu_decimal::options::{FixedDecimalFormatterOptions, GroupingStrategy};
561561
use tinystr::tinystr;
562562

@@ -570,7 +570,7 @@ mod tests {
570570
let locale = icu::locale::locale!("en-u-ca-japanese");
571571
let dtf = DateTimeFormatter::try_new(
572572
&locale.into(),
573-
NeoAutoDateMarker::with_length(NeoSkeletonLength::Medium),
573+
YMD::with_length(NeoSkeletonLength::Medium),
574574
)
575575
.expect("DateTimeFormat construction succeeds");
576576

components/datetime/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
//! ```
3030
//! use icu::calendar::{DateTime, Gregorian};
3131
//! use icu::datetime::{DateTimeFormatter, FixedCalendarDateTimeFormatter};
32-
//! use icu::datetime::fieldset::NeoYearMonthDayHourMinuteMarker;
32+
//! use icu::datetime::fieldset::YMDHM;
3333
//! use icu::datetime::neo_skeleton::NeoSkeletonLength;
3434
//! use icu::locale::{locale, Locale};
3535
//! use writeable::assert_try_writeable_eq;
@@ -38,14 +38,14 @@
3838
//! let locale = Locale::try_from_str("en-u-ca-gregory").unwrap();
3939
//! let dtf = DateTimeFormatter::try_new(
4040
//! &locale.into(),
41-
//! NeoYearMonthDayHourMinuteMarker::with_length(NeoSkeletonLength::Medium),
41+
//! YMDHM::with_length(NeoSkeletonLength::Medium),
4242
//! )
4343
//! .expect("should successfully create DateTimeFormatter instance");
4444
//!
4545
//! // Or one that selects a calendar at compile time:
4646
//! let typed_dtf = FixedCalendarDateTimeFormatter::<Gregorian, _>::try_new(
4747
//! &locale!("en").into(),
48-
//! NeoYearMonthDayHourMinuteMarker::with_length(NeoSkeletonLength::Medium),
48+
//! YMDHM::with_length(NeoSkeletonLength::Medium),
4949
//! )
5050
//! .expect("should successfully create FixedCalendarDateTimeFormatter instance");
5151
//!

0 commit comments

Comments
 (0)