Home - parsicore/parsidate GitHub Wiki
Welcome To Parsidate Wiki
This crate provides comprehensive functionality for working with the Persian (Jalali or Shamsi) calendar system.
It allows for:
- Conversion: Seamlessly convert dates and date-times between the Gregorian and Persian calendars.
- Validation: Check if a given year, month, day and date-times combination forms a valid Persian date.
- Formatting: Display Persian dates and times in various predefined formats ("short", "long", "iso") and using custom
strftime
-like patterns. - Parsing: Parse strings into
ParsiDate
orParsiDateTime
objects based on specified formats. - Date Arithmetic: Add or subtract days, months, and years from a date.
- Leap Year Calculation: Determine if a Persian or Gregorian year is a leap year (using a common 33-year cycle approximation for Persian).
- Weekday Calculation: Find the Persian name for the day of the week.
- Ordinal Day Calculation: Get the day number within the year (1-366).
- Helper Functions: Easily get the first/last day of the month/year or manipulate date/time components.
- Current Date: Get the current system date as a
ParsiDate
. - Serde Support: Optional serialization/deserialization using the
serde
feature.
It relies on the chrono
crate for underlying Gregorian date representations, current time, and some calculations.