Expand description
Dates for the Badí’ (Bahá’í) calendar and conversions between Badí’ and Gregorian dates.
See The Bahá’í Calendar at bahai.org.
§Example: create BadiDate
use badi_date::{BadiDate, BadiMonth, BadiDateOps};
let badi_date = BadiDate::new(181, BadiMonth::Month(19), 19).unwrap();
assert_eq!(
BadiDate::new(182, BadiMonth::Month(1), 1).unwrap(),
badi_date.add_days(1),
);
§Example: create LocalBadiDate
from local chrono::DateTime<Tz>
and geo Coordinates
use badi_date::{LocalBadiDate, BadiMonth, Coordinates, FromDateTime};
use chrono::TimeZone;
let denver: chrono_tz::Tz = "America/Denver".parse().unwrap();
let coords = Some(Coordinates::new(39.613319, -105.016647).unwrap());
let date = denver.with_ymd_and_hms(2024, 3, 19, 18, 0, 0).unwrap();
let badi_date = LocalBadiDate::from_datetime(date, coords).unwrap();
assert_eq!(
badi_date,
LocalBadiDate::new(180, BadiMonth::Month(19), 19, denver, coords).unwrap(),
);
§Example: create LocalBadiDate
from local chrono::DateTime<Tz>
without Coordinates
use badi_date::{LocalBadiDate, BadiMonth, Coordinates, FromDateTime};
use chrono::TimeZone;
let denver: chrono_tz::Tz = "America/Denver".parse().unwrap();
let date = denver.with_ymd_and_hms(2024, 3, 19, 18, 0, 0).unwrap();
let badi_date = LocalBadiDate::from_datetime(date, None).unwrap();
assert_eq!(
LocalBadiDate::new(181, BadiMonth::Month(1), 1, denver, None).unwrap(),
badi_date,
);
Structs§
- Badi
Date - A structure that holds a date in the Badí‘ (Bahá’í) calendar without time zone or location info
- Coordinates
- WGS-84 GPS coordinates used to calculate sunset times for a
LocalBadiDate
- Local
Badi Date - A structure that holds a date in the Badí‘ (Bahá’í) calendar with associated time zone and optional coordinates
Enums§
- Badi
Date Error - Error returned from trying to construct a
BadiDateLike
with invalid parameters - Badi
Month - Represents one of the 19 Bahá’í months or Ayyám-i-Há
- Bahai
Holy Day - List of the 11 Bahá’í Holy Days (9 on which work is to be suspended) See https://www.bahai.org/action/devotional-life/calendar
- Coordinates
Error - Error returned for invalid
Coordinates
- DayChange
Action - Determines resulting day in a returned
BadiDateLike
copy when adding/subtractingBadiMonth
s
Traits§
- Badi
Date Like - Common trait for
BadiDate
andLocalBadiDate
- Badi
Date Ops - Provides methods to return a modified copy of a
BadiDateLike
- From
Date Time - Provides methods to create a
LocalBadiDate
from a GregorianDateTime
- Holy
DayProviding - Provides methods to get the current, previous, and next Bahá’í holy day
- Local
Badi Date Like - Provides localization attributes for
LocalBadiDate
- ToDate
Time - Provides methods to convert
LocalBadiDate
to a local GregorianDateTime<Tz>