mirror of
https://git.pumpin.online/funkpower/typikon.git
synced 2026-10-22 18:57:13 +00:00
The years this calendar answers for are now 1 to 9999 and enforced at every constructor. Arithmetic saturates instead of wrapping, which in a release build had put a date in antiquity and produced an ISO string that was not ten characters long; a seven-day walk stops at the boundary rather than running past it. --days took any integer and aborted the process trying to allocate for it, as did --indent. Both are bounded now. --update-menaion parsed a day out of a fetched page with no bound on it and wrote keys like 01-4294967295 that no lookup could ever match, then wrote the file even when the parse had failed, in replace mode, which would have blanked a year of commemorations in a calendar that had been working. It bounds the day by the month and refuses to write when most of the year comes back empty. today() shelled out to date(1) and fell back to UTC without a word when it was absent, so a container reported the wrong day either side of midnight. It says so now. The UGCC loaded the Ruthenian menaion. That is the Metropolia of Pittsburgh's calendar of saints, and lending it to Kyiv is the same error as lending the law, in a release whose headline is that a church's law is never borrowed. Also: has_obligation was dead API about to be frozen, and two ptr::eq comparisons stood in for asking whether the discipline was overridden, which is what they meant.
10 lines
548 B
Rust
10 lines
548 B
Rust
fn main() {
|
|
use typikon::calendars::{Date, MAX_YEAR, MIN_YEAR};
|
|
println!("MIN {:?} = {:?}", Date::MIN, Date::MIN.ymd());
|
|
println!("MAX {:?} = {:?}", Date::MAX, Date::MAX.ymd());
|
|
println!("from_ymd(1,1,1) {:?}", Date::from_ymd(MIN_YEAR, 1, 1).map(|d| d.iso()));
|
|
println!("from_ymd(9999,12,31){:?}", Date::from_ymd(MAX_YEAR, 12, 31).map(|d| d.iso()));
|
|
println!("from_ymd(10000,1,1) {:?}", Date::from_ymd(10000, 1, 1).map(|d| d.iso()));
|
|
println!("from_ymd(0,1,1) {:?}", Date::from_ymd(0, 1, 1).map(|d| d.iso()));
|
|
}
|