Skip to content
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

Merged
merged 3 commits into from
Nov 17, 2021

Conversation

Manishearth
Copy link
Member

@Manishearth Manishearth commented Nov 17, 2021

This is basically rhe same implementation as the gregorian calendar with a different zero year.

Fixes #1118

zbraniecki
zbraniecki previously approved these changes Nov 17, 2021
Copy link
Member

@zbraniecki zbraniecki left a 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.

pub struct BuddhistDateInner(IsoDateInner);

impl Calendar for Buddhist {
type DateInner = BuddhistDateInner;
Copy link
Member

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?

Comment on lines +135 to +136
era: types::Era(tinystr8!("be")),
number: buddhist_year,
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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.

@Manishearth
Copy link
Member Author

oops, did not intend to rerequest a review

@Manishearth Manishearth merged commit 1c296f0 into unicode-org:main Nov 17, 2021
@Manishearth Manishearth deleted the buddhist-cal branch November 17, 2021 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement the Buddhist calendar
3 participants