Month - jalalvandi/ParsiDate GitHub Wiki
month
Method Returns the numerical representation of the month component of the Persian date.
Description
This method provides read-only access to the month value stored within the ParsiDate
instance. The months are numbered according to the standard Persian calendar:
- 1: Farvardin (فروردین)
- 2: Ordibehesht (اردیبهشت)
- 3: Khordad (خرداد)
- 4: Tir (تیر)
- 5: Mordad (مرداد)
- 6: Shahrivar (شهریور)
- 7: Mehr (مهر)
- 8: Aban (آبان)
- 9: Azar (آذر)
- 10: Dey (دی)
- 11: Bahman (بهمن)
- 12: Esfand (اسفند)
Assumption: This method assumes the ParsiDate
instance holds a valid month number (1-12), as typically ensured by the constructors.
Returns
- An integer (
u8
or similar type) representing the month, where 1 corresponds to Farvardin and 12 corresponds to Esfand.
Examples (Rust)
use parsidate::ParsiDate; // Assuming use of a hypothetical ParsiDate struct
// Example 1: Getting the month Mordad (5)
let date = ParsiDate::new(1403, 5, 2).unwrap();
assert_eq!(date.month(), 5);
// Example 2: Getting the month Esfand (12)
let date_esfand = ParsiDate::new(1403, 12, 30).unwrap();
assert_eq!(date_esfand.month(), 12);