Module persian

Module persian 

Source
Expand description

Persian month/weekday names, numeral conversion, and month parsing. Persian calendar data: month names, weekday names, and numeral conversion.

Provides both Persian script and romanized forms for all calendar labels, plus a parser that accepts either form as input.

Constants§

MONTH_DAYS
Number of days in each month (index 0 = Farvardin). Months 1–6 have 31 days, months 7–11 have 30 days, month 12 has 29 (or 30 in leap years, handled by shahanshahi::days_in_month).
MONTH_NAMES
Month names in Persian script (Farvardin through Esfand).
MONTH_NAMES_ROMANIZED
Month names in romanized form (lowercase), used as default display and for parsing user input.
WEEKDAY_NAMES_EN
Short weekday names in English (Saturday to Friday)
WEEKDAY_NAMES_FA
Short weekday names in Persian (Saturday to Friday). Prefixed with U+200E (LTR mark) to prevent terminal BiDi reordering.

Functions§

parse_month
Parse a month string into a 1-based month index (1–12).
to_persian_digits
Replace all ASCII digits (0–9) in a string with their Persian equivalents (۰–۹).