-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Buddhist calendar calculations #1305
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm. I'd suggest extracting 543
as a const/static.
components/calendar/src/buddhist.rs
Outdated
pub struct BuddhistDateInner(IsoDateInner); | ||
|
||
impl Calendar for Buddhist { | ||
type DateInner = BuddhistDateInner; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: just make DateInner = IsoDateInner
. Why do we need the wrapper?
era: types::Era(tinystr8!("be")), | ||
number: buddhist_year, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: this creates negative years in the "be" era. Is that correct, or is there a BCE-like era in this calendar?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's "correct" in that the calendar is not supposed to be used for past dates, but we already decided that we won't support cutoff dates for calendars and instead will fall back to negative eras.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right; I was asking if this calendar system has an era for old dates, something like "BBE" (before buddhist era)? If not, then negative dates in the current era is fine.
oops, did not intend to rerequest a review |
This is basically rhe same implementation as the gregorian calendar with a different zero year.
Fixes #1118