Skip to content

Commit 4acf3bc

Browse files
committed
Remove HijriSimulatedMecca / islamic-rgsa
The spec doesn't have it anymore Change-Id: I6a6a6964444bf7d9c9c44a0a25d5db674f97ab1e
1 parent c035688 commit 4acf3bc

File tree

7 files changed

+51
-56
lines changed

7 files changed

+51
-56
lines changed

src/builtins/core/calendar.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,6 @@ impl Calendar {
9090
pub const HIJRI_TABULAR_THURSDAY: Self = Self::new(AnyCalendarKind::HijriTabularTypeIIThursday);
9191
/// The Hijri Umm al-Qura calendar
9292
pub const HIJRI_UMM_AL_QURA: Self = Self::new(AnyCalendarKind::HijriUmmAlQura);
93-
/// The Hijri simulated calendar
94-
pub const HIJRI_SIMULATED: Self = Self::new(AnyCalendarKind::HijriSimulatedMecca);
9593
/// The ISO 8601 calendar
9694
pub const ISO: Self = Self::new(AnyCalendarKind::Iso);
9795
/// The Japanese calendar
@@ -135,7 +133,8 @@ impl Calendar {
135133
}
136134
}
137135
AnyCalendarKind::HijriSimulatedMecca => {
138-
const { &AnyCalendar::HijriSimulated(Hijri::new_simulated_mecca()) }
136+
// This calendar is currently unsupported by Temporal
137+
&AnyCalendar::Iso(Iso)
139138
}
140139
AnyCalendarKind::HijriTabularTypeIIThursday => {
141140
const {

src/builtins/core/plain_month_day.rs

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -528,34 +528,30 @@ mod tests {
528528

529529
#[test]
530530
/// This test is for calendars where we don't wish to hardcode dates; but we do wish to know
531-
/// that monthcodes can be constructed without issue
532-
fn automated_reference_year() {
531+
/// that monthcodes can be constructed without issue (currently only UAQ)
532+
fn automated_uaq_reference_year() {
533533
let reference_iso = IsoDate::new_unchecked(1972, 12, 31);
534-
for cal in [
535-
AnyCalendarKind::HijriSimulatedMecca,
536-
AnyCalendarKind::HijriUmmAlQura,
537-
] {
538-
let calendar = Calendar::new(cal);
539-
for month in 1..=12 {
540-
for day in [29, 30] {
541-
let month_code = crate::builtins::calendar::month_to_month_code(month).unwrap();
542-
543-
let calendar_fields = CalendarFields {
544-
month_code: Some(month_code),
545-
day: Some(day),
546-
..Default::default()
547-
};
548-
549-
let md = calendar
550-
.month_day_from_fields(calendar_fields, Overflow::Reject)
551-
.unwrap();
552-
553-
assert!(
554-
md.iso <= reference_iso,
555-
"Reference ISO for {month}-{day} must be before 1972-12-31, found, {:?}",
556-
md.iso,
557-
);
558-
}
534+
535+
let calendar = Calendar::new(AnyCalendarKind::HijriUmmAlQura);
536+
for month in 1..=12 {
537+
for day in [29, 30] {
538+
let month_code = crate::builtins::calendar::month_to_month_code(month).unwrap();
539+
540+
let calendar_fields = CalendarFields {
541+
month_code: Some(month_code),
542+
day: Some(day),
543+
..Default::default()
544+
};
545+
546+
let md = calendar
547+
.month_day_from_fields(calendar_fields, Overflow::Reject)
548+
.unwrap();
549+
550+
assert!(
551+
md.iso <= reference_iso,
552+
"Reference ISO for {month}-{day} must be before 1972-12-31, found, {:?}",
553+
md.iso,
554+
);
559555
}
560556
}
561557
}

src/parsed_intermediates.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ use ixdtf::records::UtcOffsetRecordOrZ;
2424
fn extract_kind(calendar: Option<&[u8]>) -> TemporalResult<AnyCalendarKind> {
2525
Ok(calendar
2626
.map(Calendar::try_kind_from_utf8)
27+
// Note that this will successfully parse AnyCalendarKind::HijriSimulatedMecca
28+
// However, Calendar::new will immediately turn it into an ISO calendar,
29+
// so we don't need to do anything here.
2730
.transpose()?
2831
.unwrap_or(AnyCalendarKind::Iso))
2932
}

temporal_capi/bindings/c/AnyCalendarKind.d.h

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

temporal_capi/bindings/cpp/temporal_rs/AnyCalendarKind.d.hpp

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

temporal_capi/bindings/cpp/temporal_rs/AnyCalendarKind.hpp

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

temporal_capi/src/calendar.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ pub mod ffi {
1818
Hebrew,
1919
Indian,
2020
HijriTabularTypeIIFriday,
21-
HijriSimulatedMecca,
2221
HijriTabularTypeIIThursday,
2322
HijriUmmAlQura,
2423
Iso,
@@ -33,6 +32,8 @@ pub mod ffi {
3332
let value = icu_locale::extensions::unicode::Value::try_from_utf8(s).ok()?;
3433
let algorithm = CalendarAlgorithm::try_from(&value).ok()?;
3534
match icu_calendar::AnyCalendarKind::try_from(algorithm) {
35+
// islamic-rgsa / simulated-mecca is supported by ICU4X but not Temporal
36+
Ok(icu_calendar::AnyCalendarKind::HijriSimulatedMecca) => None,
3637
Ok(c) => Some(c.into()),
3738
Err(()) if algorithm == CalendarAlgorithm::Hijri(None) => {
3839
Some(Self::HijriTabularTypeIIFriday)

0 commit comments

Comments
 (0)