Year - jalalvandi/ParsiDate GitHub Wiki
year
Method Returns the year component of the Persian date.
Description
This method provides simple, read-only access to the year value stored within the ParsiDate
instance. The year represents the Persian (Hejri-Shamsi) year number.
Assumption: This method assumes the ParsiDate
instance holds a valid year number (typically within the range 1-9999), as usually ensured by the safe constructors (ParsiDate::new
).
Returns
- An integer (
i32
or similar type) representing the year component of the date.
Examples (Rust)
use parsidate::ParsiDate; // Assuming use of a hypothetical ParsiDate struct
// Example 1: Getting the year 1403
let date = ParsiDate::new(1403, 5, 2).unwrap();
assert_eq!(date.year(), 1403);
// Example 2: Getting an earlier year
let date_early = ParsiDate::new(50, 1, 1).unwrap(); // Year 50 SH
assert_eq!(date_early.year(), 50);
// Example 3: Getting the maximum supported year (assuming 9999)
// let date_max = ParsiDate::new(9999, 12, 29).unwrap(); // Assuming 9999 is common
// assert_eq!(date_max.year(), 9999);