@@ -339,26 +339,6 @@ pub enum NeoDateComponents {
339
339
/// The day of the week alone, as in
340
340
/// “Saturday”.
341
341
Weekday ,
342
- /// Fields to represent the day chosen by locale.
343
- ///
344
- /// These are the _standard date patterns_ for types "long", "medium", and
345
- /// "short" as defined in [UTS 35]. For "full", use
346
- /// [`AutoWeekday`](NeoDateComponents::AutoWeekday).
347
- ///
348
- /// This is often, but not always, the same as
349
- /// [`YearMonthDay`](NeoDateComponents::YearMonthDay).
350
- ///
351
- /// [UTS 35]: <https://www.unicode.org/reports/tr35/tr35-dates.html#dateFormats>
352
- Auto ,
353
- /// Fields to represent the day chosen by locale, hinting to also include
354
- /// a weekday field.
355
- ///
356
- /// This is the _standard date pattern_ for type "full", extended with
357
- /// skeleton data in the short and medium forms.
358
- ///
359
- /// This is often, but not always, the same as
360
- /// [`YearMonthDayWeekday`](NeoDateComponents::YearMonthDayWeekday).
361
- AutoWeekday ,
362
342
}
363
343
364
344
impl NeoDateComponents {
@@ -371,8 +351,6 @@ impl NeoDateComponents {
371
351
Self :: MonthDayWeekday ,
372
352
Self :: YearMonthDayWeekday ,
373
353
Self :: Weekday ,
374
- Self :: Auto ,
375
- Self :: AutoWeekday ,
376
354
] ;
377
355
378
356
const DAY : & ' static DataMarkerAttributes = DataMarkerAttributes :: from_str_or_panic ( "d" ) ;
@@ -386,9 +364,6 @@ impl NeoDateComponents {
386
364
const YEAR_MONTH_DAY_WEEKDAY : & ' static DataMarkerAttributes =
387
365
DataMarkerAttributes :: from_str_or_panic ( "ym0de" ) ;
388
366
const WEEKDAY : & ' static DataMarkerAttributes = DataMarkerAttributes :: from_str_or_panic ( "e" ) ;
389
- const AUTO : & ' static DataMarkerAttributes = DataMarkerAttributes :: from_str_or_panic ( "a1" ) ;
390
- const AUTO_WEEKDAY : & ' static DataMarkerAttributes =
391
- DataMarkerAttributes :: from_str_or_panic ( "a1e" ) ;
392
367
393
368
// For matching
394
369
const DAY_STR : & ' static str = Self :: DAY . as_str ( ) ;
@@ -398,8 +373,6 @@ impl NeoDateComponents {
398
373
const MONTH_DAY_WEEKDAY_STR : & ' static str = Self :: MONTH_DAY_WEEKDAY . as_str ( ) ;
399
374
const YEAR_MONTH_DAY_WEEKDAY_STR : & ' static str = Self :: YEAR_MONTH_DAY_WEEKDAY . as_str ( ) ;
400
375
const WEEKDAY_STR : & ' static str = Self :: WEEKDAY . as_str ( ) ;
401
- const AUTO_STR : & ' static str = Self :: AUTO . as_str ( ) ;
402
- const AUTO_WEEKDAY_STR : & ' static str = Self :: AUTO_WEEKDAY . as_str ( ) ;
403
376
404
377
/// Returns a stable string identifying this set of components.
405
378
///
@@ -410,7 +383,6 @@ impl NeoDateComponents {
410
383
/// 1. Lowercase letters are chosen where there is no ambiguity: `G` becomes `g`\*
411
384
/// 2. Capitals are replaced with their lowercase and a number 0: `M` becomes `m0`
412
385
/// 3. A single symbol is included for each component: length doesn't matter
413
- /// 4. The "auto" style is represented as `a1`
414
386
///
415
387
/// \* `g` represents a different field, but it is never used in skeleta.
416
388
///
@@ -433,8 +405,6 @@ impl NeoDateComponents {
433
405
Self :: MonthDayWeekday => Self :: MONTH_DAY_WEEKDAY ,
434
406
Self :: YearMonthDayWeekday => Self :: YEAR_MONTH_DAY_WEEKDAY ,
435
407
Self :: Weekday => Self :: WEEKDAY ,
436
- Self :: Auto => Self :: AUTO ,
437
- Self :: AutoWeekday => Self :: AUTO_WEEKDAY ,
438
408
}
439
409
}
440
410
@@ -462,8 +432,6 @@ impl NeoDateComponents {
462
432
Self :: MONTH_DAY_WEEKDAY_STR => Some ( Self :: MonthDayWeekday ) ,
463
433
Self :: YEAR_MONTH_DAY_WEEKDAY_STR => Some ( Self :: YearMonthDayWeekday ) ,
464
434
Self :: WEEKDAY_STR => Some ( Self :: Weekday ) ,
465
- Self :: AUTO_STR => Some ( Self :: Auto ) ,
466
- Self :: AUTO_WEEKDAY_STR => Some ( Self :: AutoWeekday ) ,
467
435
_ => None ,
468
436
}
469
437
}
@@ -478,8 +446,6 @@ impl NeoDateComponents {
478
446
Self :: MonthDayWeekday => false ,
479
447
Self :: YearMonthDayWeekday => true ,
480
448
Self :: Weekday => false ,
481
- Self :: Auto => true ,
482
- Self :: AutoWeekday => true ,
483
449
}
484
450
}
485
451
@@ -493,8 +459,6 @@ impl NeoDateComponents {
493
459
Self :: MonthDayWeekday => true ,
494
460
Self :: YearMonthDayWeekday => true ,
495
461
Self :: Weekday => false ,
496
- Self :: Auto => true ,
497
- Self :: AutoWeekday => true ,
498
462
}
499
463
}
500
464
@@ -508,8 +472,6 @@ impl NeoDateComponents {
508
472
Self :: MonthDayWeekday => true ,
509
473
Self :: YearMonthDayWeekday => true ,
510
474
Self :: Weekday => false ,
511
- Self :: Auto => true ,
512
- Self :: AutoWeekday => true ,
513
475
}
514
476
}
515
477
@@ -523,8 +485,6 @@ impl NeoDateComponents {
523
485
Self :: MonthDayWeekday => true ,
524
486
Self :: YearMonthDayWeekday => true ,
525
487
Self :: Weekday => true ,
526
- Self :: Auto => false ,
527
- Self :: AutoWeekday => true ,
528
488
}
529
489
}
530
490
@@ -559,27 +519,22 @@ pub enum NeoCalendarPeriodComponents {
559
519
/// A year, as in
560
520
/// “2000”.
561
521
Year ,
562
- /// The year and week of the year, as in
563
- /// “52nd week of 1999”.
564
- YearWeek ,
565
522
// TODO(#501): Consider adding support for Quarter and YearQuarter.
566
523
}
567
524
568
525
impl NeoCalendarPeriodComponents {
569
526
/// All values of this enum.
570
- pub const VALUES : & ' static [ Self ] = & [ Self :: Month , Self :: YearMonth , Self :: Year , Self :: YearWeek ] ;
527
+ pub const VALUES : & ' static [ Self ] = & [ Self :: Month , Self :: YearMonth , Self :: Year ] ;
571
528
572
529
const MONTH : & ' static DataMarkerAttributes = DataMarkerAttributes :: from_str_or_panic ( "m0" ) ;
573
530
const YEAR_MONTH : & ' static DataMarkerAttributes =
574
531
DataMarkerAttributes :: from_str_or_panic ( "ym0" ) ;
575
532
const YEAR : & ' static DataMarkerAttributes = DataMarkerAttributes :: from_str_or_panic ( "y" ) ;
576
- const YEAR_WEEK : & ' static DataMarkerAttributes = DataMarkerAttributes :: from_str_or_panic ( "y0w" ) ;
577
533
578
534
// For matching
579
535
const MONTH_STR : & ' static str = Self :: MONTH . as_str ( ) ;
580
536
const YEAR_MONTH_STR : & ' static str = Self :: YEAR_MONTH . as_str ( ) ;
581
537
const YEAR_STR : & ' static str = Self :: YEAR . as_str ( ) ;
582
- const YEAR_WEEK_STR : & ' static str = Self :: YEAR_WEEK . as_str ( ) ;
583
538
584
539
/// Returns a stable string identifying this set of components.
585
540
///
@@ -589,7 +544,6 @@ impl NeoCalendarPeriodComponents {
589
544
Self :: Month => Self :: MONTH ,
590
545
Self :: YearMonth => Self :: YEAR_MONTH ,
591
546
Self :: Year => Self :: YEAR ,
592
- Self :: YearWeek => Self :: YEAR_WEEK ,
593
547
}
594
548
}
595
549
@@ -601,7 +555,6 @@ impl NeoCalendarPeriodComponents {
601
555
Self :: MONTH_STR => Some ( Self :: Month ) ,
602
556
Self :: YEAR_MONTH_STR => Some ( Self :: YearMonth ) ,
603
557
Self :: YEAR_STR => Some ( Self :: Year ) ,
604
- Self :: YEAR_WEEK_STR => Some ( Self :: YearWeek ) ,
605
558
_ => None ,
606
559
}
607
560
}
@@ -612,7 +565,6 @@ impl NeoCalendarPeriodComponents {
612
565
Self :: Month => false ,
613
566
Self :: YearMonth => true ,
614
567
Self :: Year => true ,
615
- Self :: YearWeek => true ,
616
568
}
617
569
}
618
570
@@ -622,7 +574,6 @@ impl NeoCalendarPeriodComponents {
622
574
Self :: Month => true ,
623
575
Self :: YearMonth => true ,
624
576
Self :: Year => false ,
625
- Self :: YearWeek => false ,
626
577
}
627
578
}
628
579
@@ -658,30 +609,20 @@ pub enum NeoTimeComponents {
658
609
/// A time of day with a 24-hour clock,
659
610
/// with the precision chosen by [`TimePrecision`]
660
611
Time24 ,
661
- /// Fields to represent the time chosen by the locale.
662
- ///
663
- /// These are the _standard time patterns_ for types "medium" and
664
- /// "short" as defined in [UTS 35]. For "full" and "long", use a
665
- /// formatter that includes a time zone.
666
- ///
667
- /// [UTS 35]: <https://www.unicode.org/reports/tr35/tr35-dates.html#dateFormats>
668
- Auto ,
669
612
}
670
613
671
614
impl NeoTimeComponents {
672
615
/// All values of this enum.
673
- pub const VALUES : & ' static [ Self ] = & [ Self :: Time , Self :: Time12 , Self :: Time24 , Self :: Auto ] ;
616
+ pub const VALUES : & ' static [ Self ] = & [ Self :: Time , Self :: Time12 , Self :: Time24 ] ;
674
617
675
618
const HOUR : & ' static DataMarkerAttributes = DataMarkerAttributes :: from_str_or_panic ( "j" ) ;
676
619
const HOUR12 : & ' static DataMarkerAttributes = DataMarkerAttributes :: from_str_or_panic ( "h" ) ;
677
620
const HOUR24 : & ' static DataMarkerAttributes = DataMarkerAttributes :: from_str_or_panic ( "h0" ) ;
678
- const AUTO : & ' static DataMarkerAttributes = DataMarkerAttributes :: from_str_or_panic ( "a1" ) ;
679
621
680
622
// For matching
681
623
const HOUR_STR : & ' static str = Self :: HOUR . as_str ( ) ;
682
624
const HOUR12_STR : & ' static str = Self :: HOUR12 . as_str ( ) ;
683
625
const HOUR24_STR : & ' static str = Self :: HOUR24 . as_str ( ) ;
684
- const AUTO_STR : & ' static str = Self :: AUTO . as_str ( ) ;
685
626
686
627
/// Returns a stable string identifying this set of components.
687
628
///
@@ -691,7 +632,6 @@ impl NeoTimeComponents {
691
632
Self :: Time => Self :: HOUR ,
692
633
Self :: Time12 => Self :: HOUR12 ,
693
634
Self :: Time24 => Self :: HOUR24 ,
694
- Self :: Auto => Self :: AUTO ,
695
635
}
696
636
}
697
637
@@ -703,7 +643,6 @@ impl NeoTimeComponents {
703
643
Self :: HOUR_STR => Some ( Self :: Time ) ,
704
644
Self :: HOUR12_STR => Some ( Self :: Time12 ) ,
705
645
Self :: HOUR24_STR => Some ( Self :: Time24 ) ,
706
- Self :: AUTO_STR => Some ( Self :: Auto ) ,
707
646
_ => None ,
708
647
}
709
648
}
@@ -1081,19 +1020,6 @@ impl NeoDateSkeleton {
1081
1020
year_style : None ,
1082
1021
}
1083
1022
}
1084
-
1085
- /// Converts a [`length::Date`] to a [`NeoDateComponents`] and [`NeoSkeletonLength`].
1086
- #[ doc( hidden) ] // the types involved in this mapping may change
1087
- #[ cfg( feature = "datagen" ) ]
1088
- pub fn from_date_length ( date_length : length:: Date ) -> NeoDateSkeleton {
1089
- let ( components, length) = match date_length {
1090
- length:: Date :: Full => ( NeoDateComponents :: AutoWeekday , NeoSkeletonLength :: Long ) ,
1091
- length:: Date :: Long => ( NeoDateComponents :: Auto , NeoSkeletonLength :: Long ) ,
1092
- length:: Date :: Medium => ( NeoDateComponents :: Auto , NeoSkeletonLength :: Medium ) ,
1093
- length:: Date :: Short => ( NeoDateComponents :: Auto , NeoSkeletonLength :: Short ) ,
1094
- } ;
1095
- NeoDateSkeleton :: for_length_and_components ( length, components)
1096
- }
1097
1023
}
1098
1024
1099
1025
/// A skeleton for formatting a calendar period (i.e. month or year).
@@ -1274,25 +1200,3 @@ impl NeoSkeleton {
1274
1200
}
1275
1201
}
1276
1202
}
1277
-
1278
- impl NeoDateTimeSkeleton {
1279
- #[ doc( hidden) ] // mostly internal; maps from old API to new API
1280
- #[ cfg( feature = "datagen" ) ]
1281
- pub fn from_date_time_length (
1282
- date_length : crate :: options:: length:: Date ,
1283
- time_length : crate :: options:: length:: Time ,
1284
- ) -> Self {
1285
- let date_skeleton = NeoDateSkeleton :: from_date_length ( date_length) ;
1286
- let time_precision = TimePrecision :: from_time_length ( time_length) ;
1287
- NeoDateTimeSkeleton {
1288
- length : date_skeleton. length ,
1289
- components : NeoDateTimeComponents :: DateTime (
1290
- date_skeleton. components ,
1291
- NeoTimeComponents :: Time ,
1292
- ) ,
1293
- alignment : None ,
1294
- year_style : None ,
1295
- time_precision : Some ( time_precision) ,
1296
- }
1297
- }
1298
- }
0 commit comments