-
-
Notifications
You must be signed in to change notification settings - Fork 827
ICU-23167 Change Chinese and Dangi calendar epoch to 1AD #3610
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
base: main
Are you sure you want to change the base?
Conversation
6a7a7d5
to
ff13389
Compare
Notice: the branch changed across the force-push!
~ Your Friendly Jira-GitHub PR Checker Bot |
Notice during the change, I also discover an unrelated minor issue ICU-23198. That issue is not addressed in this PR but will handle separately |
543b395
to
e2480e3
Compare
Hooray! The files in the branch are the same across the force-push. 😃 ~ Your Friendly Jira-GitHub PR Checker Bot |
Remove unnecessary structure to support other epoch in Chinese and Dangi calendar. Rename and keep CYCLE_EPOCH for the calculation of 60 years cycle. This should only change the meaning of values for set/get extended year and woy year.
e2480e3
to
06e09ef
Compare
Notice: the branch changed across the force-push!
~ Your Friendly Jira-GitHub PR Checker Bot |
@sffc ping |
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.
Nice work!
What is calendar.res
and why did it change in this PR?
@@ -253,7 +247,6 @@ class U_I18N_API ChineseCalendar : public Calendar { | |||
virtual int32_t getActualMaximum(UCalendarDateFields field, UErrorCode& status) const override; | |||
|
|||
struct Setting { | |||
int32_t epochYear; |
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.
Praise: Clever to use the mechanism already in place to make Chinese and Dangi have different extended years in order to change the extended year for both calendars.
if (info.month < 10 || | ||
int extended_year = gyear - CHINESE_EPOCH_YEAR; | ||
int cycle_year = gyear - CYCLE_EPOCH; | ||
if (info.month < 10 || // TODO(ICU-23198) < 10 or < 11 ???? |
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.
I think 10 is correct; it just needs to be a month that is always after July and before December. So I think anything between 8 and 11 should work. The condition should return false
if the Chinese date is before the Gregorian new year (most of the year) and true
if it is after the Gregorian new year (the last 3-8 weeks).
Remove unnecessary structure to support other epoch in Chinese and Dangi calendar. Rename and keep CYCLE_EPOCH for the calculation of 60 years cycle.
This should only change the meaning of values for set/get extended year and woy year.
Also need to address some int32_t overflow issue after the value of gyear shift
The extended year value of "chinese" calendar reduced 2637 (newValue = oldValue -2637), and the value of "dangi" calendar reduced 2333 (newValue = oldValue -2333).
Checklist