Skip to main content

Crate shahanshahi

Crate shahanshahi 

Source
Expand description

Shahanshahi (Imperial Iranian) calendar.

This crate is spec-first: SPEC.md defines calendar rules (SPEC_VERSION). Golden rows in data/reference-dates.json anchor tests; public APIs may still evolve before 1.0.0 (see SemVer policy in the repo changelog).

§Types

§Features

Structs§

ChronoNaiveDateOutOfRange
The Gregorian civil date is valid for GregorianDate but cannot be represented as a chrono::NaiveDate (chrono limits the representable year range).
GregorianDate
A valid proleptic Gregorian civil date (year, month 1..=12, day consistent with month/leap rule).
ShahanshahiDate
A valid civil date in the Shahanshahi (Imperial Iranian) calendar: 1 = Farvardin … 12 = Esfand, with month lengths from the 1925 solar civil law (SPEC.md § Months). Leap Esfand uses Mode A (33-year arithmetic) on the underlying Hijri Shamsi year Y_H = Y_S − 1180.

Enums§

GregorianDateError
Why a GregorianDate could not be constructed.
Locale
Output locale for [ShahanshahiDate::format_localized].
ShahanshahiDateError
Why a ShahanshahiDate could not be constructed.
Weekday
A day of the week, ordered with Saturday (the first day of the Iranian civil week) first.

Constants§

SPEC_VERSION
Tracks which written specification version this build targets.

Functions§

is_shahanshahi_leap_arithmetic
Shahanshahi leap year using Mode A (same solar year as underlying Hijri Shamsi).
is_solar_hijri_leap_arithmetic
Solar Hijri leap year per the 33-year arithmetic rule (Heydari-Malayeri / Borkowski range).
shahanshahi_month_name
Returns the ASCII romanization of the Shahanshahi month name for a 1-based month index (1 = "Farvardin" … 12 = "Esfand"), or None for any value outside 1..=12.
shahanshahi_month_name_persian
Returns the Persian script name of the Shahanshahi month for a 1-based month index (1 = "فروردین" … 12 = "اسفند"), or None for any value outside 1..=12.
shahanshahi_to_hijri_shamsi_year
Underlying Solar Hijri year from Shahanshahi year (proleptic offset).
to_persian_numerals
Replaces every ASCII decimal digit in s with its Persian numeral equivalent.