pub struct Dangi { /* private fields */ }
Expand description
The Traditional Korean (Dangi) Calendar
The Dangi Calendar is a lunisolar calendar used traditionally in North and South Korea.
It is often used today to track important cultural events and holidays like Seollal
(Korean lunar new year). It is similar to the Chinese lunar calendar (see Chinese
),
except that observations are based in Korea (currently UTC+9) rather than China (UTC+8).
This can cause some differences; for example, 2012 was a leap year, but in the Dangi
calendar the leap month was 3, while in the Chinese calendar the leap month was 4.
This calendar is currently in a preview state: formatting for this calendar is not going to be perfect.
use icu::calendar::cal::{Chinese, Dangi};
use icu::calendar::Date;
use tinystr::tinystr;
let iso_a = Date::try_new_iso(2012, 4, 23).unwrap();
let dangi_a = iso_a.to_calendar(Dangi::new());
let chinese_a = iso_a.to_calendar(Chinese::new());
assert_eq!(dangi_a.month().standard_code.0, tinystr!(4, "M03L"));
assert_eq!(chinese_a.month().standard_code.0, tinystr!(4, "M04"));
let iso_b = Date::try_new_iso(2012, 5, 23).unwrap();
let dangi_b = iso_b.to_calendar(Dangi::new());
let chinese_b = iso_b.to_calendar(Chinese::new());
assert_eq!(dangi_b.month().standard_code.0, tinystr!(4, "M04"));
assert_eq!(chinese_b.month().standard_code.0, tinystr!(4, "M04L"));
§Era codes
This calendar does not use era codes.
§Month codes
This calendar is a lunisolar calendar. It supports regular month codes "M01" - "M12"
as well
as leap month codes "M01L" - "M12L"
.
Implementations§
Source§impl Dangi
impl Dangi
Sourcepub const fn new() -> Dangi
pub const fn new() -> Dangi
Creates a new Dangi
with some precomputed calendrical calculations.
✨ Enabled with the compiled_data
Cargo feature.
Sourcepub fn try_new_with_buffer_provider(
provider: &(impl BufferProvider + ?Sized),
) -> Result<Dangi, DataError>
pub fn try_new_with_buffer_provider( provider: &(impl BufferProvider + ?Sized), ) -> Result<Dangi, DataError>
A version of [Self :: new
] that uses custom data provided by a BufferProvider
.
✨ Enabled with the serde
feature.
Sourcepub fn try_new_unstable<D>(provider: &D) -> Result<Dangi, DataError>
pub fn try_new_unstable<D>(provider: &D) -> Result<Dangi, DataError>
A version of Self::new
that uses custom data provided by a DataProvider
.
Sourcepub fn new_always_calculating() -> Dangi
pub fn new_always_calculating() -> Dangi
Construct a new Dangi
without any precomputed calendrical calculations.
Trait Implementations§
Source§impl Calendar for Dangi
impl Calendar for Dangi
Source§type Year = CyclicYear
type Year = CyclicYear
Source§fn from_codes(
&self,
era: Option<&str>,
year: i32,
month_code: MonthCode,
day: u8,
) -> Result<<Dangi as Calendar>::DateInner, DateError>
fn from_codes( &self, era: Option<&str>, year: i32, month_code: MonthCode, day: u8, ) -> Result<<Dangi as Calendar>::DateInner, DateError>
Source§fn from_rata_die(&self, rd: RataDie) -> <Dangi as Calendar>::DateInner
fn from_rata_die(&self, rd: RataDie) -> <Dangi as Calendar>::DateInner
RataDie
Source§fn to_rata_die(&self, date: &<Dangi as Calendar>::DateInner) -> RataDie
fn to_rata_die(&self, date: &<Dangi as Calendar>::DateInner) -> RataDie
RataDie
from this dateSource§fn from_iso(&self, iso: IsoDateInner) -> <Dangi as Calendar>::DateInner
fn from_iso(&self, iso: IsoDateInner) -> <Dangi as Calendar>::DateInner
Source§fn to_iso(&self, date: &<Dangi as Calendar>::DateInner) -> IsoDateInner
fn to_iso(&self, date: &<Dangi as Calendar>::DateInner) -> IsoDateInner
Source§fn months_in_year(&self, date: &<Dangi as Calendar>::DateInner) -> u8
fn months_in_year(&self, date: &<Dangi as Calendar>::DateInner) -> u8
Source§fn days_in_year(&self, date: &<Dangi as Calendar>::DateInner) -> u16
fn days_in_year(&self, date: &<Dangi as Calendar>::DateInner) -> u16
Source§fn days_in_month(&self, date: &<Dangi as Calendar>::DateInner) -> u8
fn days_in_month(&self, date: &<Dangi as Calendar>::DateInner) -> u8
Source§fn debug_name(&self) -> &'static str
fn debug_name(&self) -> &'static str
Source§fn year_info(
&self,
date: &<Dangi as Calendar>::DateInner,
) -> <Dangi as Calendar>::Year
fn year_info( &self, date: &<Dangi as Calendar>::DateInner, ) -> <Dangi as Calendar>::Year
Source§fn is_in_leap_year(&self, date: &<Dangi as Calendar>::DateInner) -> bool
fn is_in_leap_year(&self, date: &<Dangi as Calendar>::DateInner) -> bool
Source§fn month(&self, date: &<Dangi as Calendar>::DateInner) -> MonthInfo
fn month(&self, date: &<Dangi as Calendar>::DateInner) -> MonthInfo
date
Source§fn day_of_month(&self, date: &<Dangi as Calendar>::DateInner) -> DayOfMonth
fn day_of_month(&self, date: &<Dangi as Calendar>::DateInner) -> DayOfMonth
date
Source§fn day_of_year(&self, date: &<Dangi as Calendar>::DateInner) -> DayOfYear
fn day_of_year(&self, date: &<Dangi as Calendar>::DateInner) -> DayOfYear
Source§fn calendar_algorithm(&self) -> Option<CalendarAlgorithm>
fn calendar_algorithm(&self) -> Option<CalendarAlgorithm>
CalendarAlgorithm
that is required to match
when parsing into this calendar. Read moreSource§impl CldrCalendar for Dangi
impl CldrCalendar for Dangi
Source§type YearNamesV1 = DatetimeNamesYearDangiV1
type YearNamesV1 = DatetimeNamesYearDangiV1
Source§type MonthNamesV1 = DatetimeNamesMonthDangiV1
type MonthNamesV1 = DatetimeNamesMonthDangiV1
Source§type SkeletaV1 = DatetimePatternsDateDangiV1
type SkeletaV1 = DatetimePatternsDateDangiV1
Source§impl From<Dangi> for AnyCalendar
impl From<Dangi> for AnyCalendar
Source§fn from(value: Dangi) -> AnyCalendar
fn from(value: Dangi) -> AnyCalendar
Source§impl IntoAnyCalendar for Dangi
impl IntoAnyCalendar for Dangi
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<Dangi, AnyCalendar>
fn from_any(any: AnyCalendar) -> Result<Dangi, AnyCalendar>
Source§fn from_any_ref(any: &AnyCalendar) -> Option<&Dangi>
fn from_any_ref(any: &AnyCalendar) -> Option<&Dangi>
Source§impl Ord for Dangi
impl Ord for Dangi
Source§impl PartialOrd for Dangi
impl PartialOrd for Dangi
impl Eq for Dangi
impl IntoFormattableAnyCalendar for Dangi
impl UnstableSealed for Dangi
impl UnstableSealed for Dangi
Auto Trait Implementations§
impl Freeze for Dangi
impl RefUnwindSafe for Dangi
impl !Send for Dangi
impl !Sync for Dangi
impl Unpin for Dangi
impl UnwindSafe for Dangi
Blanket Implementations§
Source§impl<C> AsCalendar for Cwhere
C: Calendar,
impl<C> AsCalendar for Cwhere
C: Calendar,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more