Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Fix calculating the calendar year in JapaneseLunisolarCalendar - #3662

Merged
tarekgh merged 1 commit into
dotnet:masterfrom
tarekgh:FixGetYearForJapaneseCalendar
Mar 13, 2016
Merged

tarekgh merged 1 commit into
dotnet:masterfrom
tarekgh:FixGetYearForJapaneseCalendar

Conversation

@tarekgh

@tarekgh tarekgh commented Mar 11, 2016

Copy link
Copy Markdown
Member

The months in this calendar is lunar months. We can have the case when a new era
starts in the middle of a month which means part of the month will belong to one
era and the rest will belong to the new era. When calculating the calendar year
number for dates which in the rest of the month and exist in the new started era,
we should still use the old era info instead of the new era info because
the rest of the month still belong to the year of last era.

Example of such date is Feb 2nd 1989. Using such date while the era starts
on Jan 8th 1989 make this date belong to that new era which it is part of
the month started with previous era. Using the new era info will have the year
we are calculating equal to the era offset (i.e. year = m_EraInfo[i].yearOffset)
and we’ll end returning zero for the year. The fix is to use the previous era
info to calculate the year

issue https://github.com/dotnet/corefx/issues/6775

@tarekgh

tarekgh commented Mar 11, 2016

Copy link
Copy Markdown
Member Author

@AlexGhiondea could you please help code review this one? thanks.

@stephentoub

Copy link
Copy Markdown
Member

Does src/mscorlib/corefx/System/Globalization/GregorianCalendarHelper.cs need to be updated as well?

@tarekgh

tarekgh commented Mar 11, 2016

Copy link
Copy Markdown
Member Author

@stephentoub yes. I'll update it. thanks for the catch

The months in this calendar is lunar months. We can have the case when a new era
starts in the middle of a month which means part of the month will belong to one
era and the rest will belong to the new era. When calculating the calendar year
number for dates which in the rest of the month and exist in the new started era,
we should still use the old era info instead of the new era info because
the rest of the month still belong to the year of last era.

Example of such date is Feb 2nd 1989. Using such date while the era starts
on Jan 8th 1989 make this date belong to that new era which it is part of
the month started with previous era. Using the new era info will have the year
we are calculating equal to the era offset (i.e. year = m_EraInfo[i].yearOffset)
and we’ll end returning zero for the year. The fix is to use the previous era
info to calculate the year

issue https://github.com/dotnet/corefx/issues/6775
@tarekgh
tarekgh force-pushed the FixGetYearForJapaneseCalendar branch from b3610be to e1fb273 Compare March 11, 2016 19:07
@tarekgh

tarekgh commented Mar 12, 2016

Copy link
Copy Markdown
Member Author

Test Ubuntu x64 Checked Build and Test please

@tarekgh

tarekgh commented Mar 12, 2016

Copy link
Copy Markdown
Member Author

test OSX x64 Checked Build and Test please

@tarekgh

tarekgh commented Mar 12, 2016

Copy link
Copy Markdown
Member Author

@dotnet-bot could you check this one please?

@jkotas

jkotas commented Mar 12, 2016

Copy link
Copy Markdown
Member

Could you please port the fix to CoreRT as well?

@tarekgh

tarekgh commented Mar 13, 2016

Copy link
Copy Markdown
Member Author

test Ubuntu x64 Checked Build and Test please

@tarekgh

tarekgh commented Mar 13, 2016

Copy link
Copy Markdown
Member Author

@jkotas yes I am going to port the fix corert/PN and also I am going to track the fix for the future desktop release

tarekgh added a commit that referenced this pull request Mar 13, 2016
Fix calculating the calendar year in JapaneseLunisolarCalendar
@tarekgh
tarekgh merged commit ca9f7d7 into dotnet:master Mar 13, 2016
tarekgh added a commit to tarekgh/corert that referenced this pull request Mar 14, 2016
@tarekgh
tarekgh deleted the FixGetYearForJapaneseCalendar branch March 25, 2019 15:27
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
…neseCalendar

Fix calculating the calendar year in JapaneseLunisolarCalendar

Commit migrated from dotnet/coreclr@ca9f7d7
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants