Struct icu_calendar::japanese::Japanese
source · pub struct Japanese { /* private fields */ }
Expand description
The Japanese Calendar (with modern eras only)
The Japanese calendar is a solar calendar used in Japan, with twelve months. The months and days are identical to that of the Gregorian calendar, however the years are counted differently using the Japanese era system.
This calendar only contains eras after Meiji, for all historical eras, check out JapaneseExtended
.
This type can be used with Date
or DateTime
to represent dates in this calendar.
Era codes
This calendar currently supports seven era codes. It supports the five post-Meiji eras
("meiji"
, "taisho"
, "showa"
, "heisei"
, "reiwa"
), as well as using the Gregorian
"bce"
and "ce"
for dates before the Meiji era.
Future eras will also be added to this type when they are decided.
These eras are loaded from data, requiring a data provider capable of providing JapaneseErasV1Marker
data (calendar/japanese@1
).
Implementations§
source§impl Japanese
impl Japanese
sourcepub fn try_new_unstable<D: DataProvider<JapaneseErasV1Marker> + ?Sized>(
data_provider: &D
) -> Result<Self, CalendarError>
pub fn try_new_unstable<D: DataProvider<JapaneseErasV1Marker> + ?Sized>( data_provider: &D ) -> Result<Self, CalendarError>
Creates a new Japanese
from locale data using only modern eras (post-meiji).
sourcepub fn try_new_with_any_provider(
provider: &impl AnyProvider + ?Sized
) -> Result<Self, CalendarError>
pub fn try_new_with_any_provider( provider: &impl AnyProvider + ?Sized ) -> Result<Self, CalendarError>
Creates a new instance using an AnyProvider
.
For details on the behavior of this function, see: Self::try_new_unstable
sourcepub fn try_new_with_buffer_provider(
provider: &impl BufferProvider + ?Sized
) -> Result<Self, CalendarError>
pub fn try_new_with_buffer_provider( provider: &impl BufferProvider + ?Sized ) -> Result<Self, CalendarError>
✨ Enabled with the "serde"
feature.
Creates a new instance using a BufferProvider
.
For details on the behavior of this function, see: Self::try_new_unstable
Trait Implementations§
source§impl Calendar for Japanese
impl Calendar for Japanese
source§fn year(&self, date: &Self::DateInner) -> FormattableYear
fn year(&self, date: &Self::DateInner) -> FormattableYear
The calendar-specific year represented by date
source§fn month(&self, date: &Self::DateInner) -> FormattableMonth
fn month(&self, date: &Self::DateInner) -> FormattableMonth
The calendar-specific month represented by date
source§fn day_of_month(&self, date: &Self::DateInner) -> DayOfMonth
fn day_of_month(&self, date: &Self::DateInner) -> DayOfMonth
The calendar-specific day-of-month represented by date
source§fn day_of_year_info(&self, date: &Self::DateInner) -> DayOfYearInfo
fn day_of_year_info(&self, date: &Self::DateInner) -> DayOfYearInfo
Information of the day of the year
§type DateInner = JapaneseDateInner
type DateInner = JapaneseDateInner
source§fn date_from_codes(
&self,
era: Era,
year: i32,
month_code: MonthCode,
day: u8
) -> Result<Self::DateInner, CalendarError>
fn date_from_codes( &self, era: Era, year: i32, month_code: MonthCode, day: u8 ) -> Result<Self::DateInner, CalendarError>
source§fn date_from_iso(&self, iso: Date<Iso>) -> JapaneseDateInner
fn date_from_iso(&self, iso: Date<Iso>) -> JapaneseDateInner
source§fn months_in_year(&self, date: &Self::DateInner) -> u8
fn months_in_year(&self, date: &Self::DateInner) -> u8
source§fn days_in_year(&self, date: &Self::DateInner) -> u32
fn days_in_year(&self, date: &Self::DateInner) -> u32
source§fn days_in_month(&self, date: &Self::DateInner) -> u8
fn days_in_month(&self, date: &Self::DateInner) -> u8
source§fn debug_name(&self) -> &'static str
fn debug_name(&self) -> &'static str
source§fn any_calendar_kind(&self) -> Option<AnyCalendarKind>
fn any_calendar_kind(&self) -> Option<AnyCalendarKind>
AnyCalendarKind
corresponding to this calendar,
if one exists. Implementors outside of icu_calendar should return Nonesource§fn day_of_week(&self, date: &Self::DateInner) -> IsoWeekday
fn day_of_week(&self, date: &Self::DateInner) -> IsoWeekday
source§impl IntoAnyCalendar for Japanese
impl IntoAnyCalendar for Japanese
source§fn to_any(self) -> AnyCalendar
fn to_any(self) -> AnyCalendar
AnyCalendar
, moving it Read moresource§fn to_any_cloned(&self) -> AnyCalendar
fn to_any_cloned(&self) -> AnyCalendar
AnyCalendar
, cloning it Read moresource§fn date_to_any(&self, d: &Self::DateInner) -> AnyDateInner
fn date_to_any(&self, d: &Self::DateInner) -> AnyDateInner
AnyDateInner
Read more