pub type KoreanTraditional = EastAsianTraditional<Korea>;Expand description
The Korean variant of the EastAsianTraditional calendar.
This type agrees with the official data published by the Korea Astronomy and Space Science Institute for the years 1900-2050.
For years since 1912, this uses adapted GB/T 33661-2017 rules,
using Korea time instead of Beijing Time.
As accurate computation is computationally expensive, years until
2100 are precomputed, and after that this type regresses to a simplified
calculation. If accuracy beyond 2100 is required, clients
can implement their own [Rules] type containing more precomputed data.
We note that the calendar is inherently uncertain for some future dates.
Before 1912 different rules
were used (those of Qing-dynasty China). This type produces correct data
for the years 1900-1912, and falls back to a simplified calculation
before 1900. If accuracy is required before 1900, clients can implement
their own [Rules] type using data such as from the excellent compilation
by Yuk Tung Liu.
The precise behavior of this calendar may change in the future if:
- New ground truth is established by published government sources
- We decide to tweak the simplified calculation
- We decide to expand or reduce the range where we are correctly handling past dates.
use icu::calendar::cal::{ChineseTraditional, KoreanTraditional};
use icu::calendar::Date;
let iso_a = Date::try_new_iso(2012, 4, 23).unwrap();
let korean_a = iso_a.to_calendar(KoreanTraditional::new());
let chinese_a = iso_a.to_calendar(ChineseTraditional::new());
assert_eq!(korean_a.month().standard_code.0, "M03L");
assert_eq!(chinese_a.month().standard_code.0, "M04");
let iso_b = Date::try_new_iso(2012, 5, 23).unwrap();
let korean_b = iso_b.to_calendar(KoreanTraditional::new());
let chinese_b = iso_b.to_calendar(ChineseTraditional::new());
assert_eq!(korean_b.month().standard_code.0, "M04");
assert_eq!(chinese_b.month().standard_code.0, "M04L");Aliased Type§
pub struct KoreanTraditional(pub Korea);Tuple Fields§
§0: KoreaImplementations§
Source§impl KoreanTraditional
impl KoreanTraditional
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Creates a new KoreanTraditional calendar.
Sourcepub fn try_new_with_buffer_provider(
_provider: &(impl BufferProvider + ?Sized),
) -> Result<Self, DataError>
👎Deprecated since 2.1.0: use `Self::new()
pub fn try_new_with_buffer_provider( _provider: &(impl BufferProvider + ?Sized), ) -> Result<Self, DataError>
Use Self::new.
A version of Self::new that uses custom data provided by a BufferProvider.
✨ Enabled with the serde feature.
Sourcepub fn try_new_unstable<D: ?Sized>(_provider: &D) -> Result<Self, DataError>
👎Deprecated since 2.1.0: use `Self::new()
pub fn try_new_unstable<D: ?Sized>(_provider: &D) -> Result<Self, DataError>
Use Self::new.
A version of Self::new that uses custom data provided by a DataProvider.
Sourcepub fn new_always_calculating() -> Self
👎Deprecated since 2.1.0: use `Self::new()
pub fn new_always_calculating() -> Self
Use Self::new.
Trait Implementations§
Source§impl IntoAnyCalendar for KoreanTraditional
impl IntoAnyCalendar for KoreanTraditional
Source§fn to_any(self) -> AnyCalendar
fn to_any(self) -> AnyCalendar
AnyCalendar, moving it Read moreSource§fn kind(&self) -> AnyCalendarKind
fn kind(&self) -> AnyCalendarKind
AnyCalendarKind enum variant associated with this calendarSource§fn from_any(any: AnyCalendar) -> Result<Self, AnyCalendar>
fn from_any(any: AnyCalendar) -> Result<Self, AnyCalendar>
Source§fn from_any_ref(any: &AnyCalendar) -> Option<&Self>
fn from_any_ref(any: &AnyCalendar) -> Option<&Self>
Source§fn date_to_any(&self, d: &Self::DateInner) -> AnyDateInner
fn date_to_any(&self, d: &Self::DateInner) -> AnyDateInner
AnyDateInner Read more