Repository navigation
ICU-23277 Update Coptic calendar to use single era #4081
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?
Changes from all commits
9d7e611
120895e
19ef409
f685298
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -248,12 +248,6 @@ public String getType() { | |||
| * @internal | ||||
| * @deprecated This API is ICU internal only. | ||||
| */ | ||||
| @Override | ||||
| @Deprecated | ||||
| protected boolean isEra0CountingBackward() { | ||||
| return true; | ||||
| } | ||||
|
|
||||
| /** | ||||
| * {@inheritDoc} | ||||
| * | ||||
|
|
@@ -267,13 +261,7 @@ protected int handleGetExtendedYear() { | |||
| if (newerField(EXTENDED_YEAR, YEAR) == EXTENDED_YEAR) { | ||||
| eyear = internalGet(EXTENDED_YEAR, 1); // Default to year 1 | ||||
| } else { | ||||
| // The year defaults to the epoch start, the era to AD | ||||
| int era = internalGet(ERA, CE); | ||||
| if (era == BCE) { | ||||
| eyear = 1 - internalGet(YEAR, 1); // Convert to extended year | ||||
| } else { | ||||
| eyear = internalGet(YEAR, 1); // Default to year 1 | ||||
| } | ||||
| eyear = internalGet(YEAR, 1); // Default to year 1 | ||||
| } | ||||
| return eyear; | ||||
| } | ||||
|
|
@@ -287,7 +275,7 @@ protected int handleGetExtendedYear() { | |||
| @Deprecated | ||||
| @Override | ||||
| protected int extendedYearToEra(int eyear) { | ||||
| return (eyear <= 0) ? BCE : CE; | ||||
| return CE; | ||||
| } | ||||
|
|
||||
| /** | ||||
|
|
@@ -299,7 +287,22 @@ protected int extendedYearToEra(int eyear) { | |||
| @Deprecated | ||||
| @Override | ||||
| protected int extendedYearToYear(int eyear) { | ||||
| return (eyear <= 0) ? 1 - eyear : eyear; | ||||
| return eyear; | ||||
| } | ||||
|
|
||||
| /** | ||||
| * {@inheritDoc} | ||||
| * | ||||
| * @internal | ||||
| * @deprecated This API is ICU internal only. | ||||
| */ | ||||
| @Override | ||||
| @Deprecated | ||||
| protected int handleGetLimit(int field, int limitType) { | ||||
| if (field == ERA) { | ||||
| return CE; // Only one era in this mode, era is always CE | ||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Issue: Coptic has never used CE (Common Era). This looks like a typo made during some previous refactor, since the era has been sometimes called AD, but that stands for "After Diocletian", not "Anno Domini". The best English/Latin name for this era based on my research is Anno Martyrum or "AM". Unless CE is intended to stand for "Coptic Era"? 🤔
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See https://github.com/unicode-org/icu/blame/7ce89a8fbb84b3ef950df9cdc162d3f7249c2e3a/icu4j/main/core/src/main/java/com/ibm/icu/util/CopticCalendar.java#L124
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is used in the code
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok so the CE era means "Coptic/Ethiopian"? 🤔
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @yumaoka You need to ask him.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The original implementation was merged into ICU4J. Doug Felt created the initial version. I guess he got the implementation from someone else. I did C port about two decades ago. I think "CE" era means "Copting/Ethiopian". |
||||
| } | ||||
| return super.handleGetLimit(field, limitType); | ||||
| } | ||||
|
|
||||
| /** | ||||
|
|
||||
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.
Issue: I think if someone explicitly set the era to the old backwards-counting era Before Diocletian (BD), then we should still do 1 - X. We should just never create BD dates implicitly.
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.
are you suggesting we do not change this part?
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'm suggesting that as long as the Before Diocletian era is public and stable, we should probably continue respecting it on input.
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'm suggesting that as long as the Before Diocletian era is public and stable, we should probably continue respecting it on input.
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.
none of them are public. They are all private