Fix calculating the calendar year in JapaneseLunisolarCalendar
authorTarek Mahmoud Sayed <tarekms@microsoft.com>
Fri, 11 Mar 2016 18:44:48 +0000 (10:44 -0800)
committerTarek Mahmoud Sayed <tarekms@microsoft.com>
Fri, 11 Mar 2016 19:07:02 +0000 (11:07 -0800)
commite1fb2736347ae51ed5d353fc9286fab470a9ce9b
treec3f56c3d6264dfc3b2fc7708368a03163a2fd489
parent586ce538403c1b859f73d97abec9bb4bfad4cab7
Fix calculating the calendar year in JapaneseLunisolarCalendar

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
src/mscorlib/corefx/System/Globalization/GregorianCalendarHelper.cs
src/mscorlib/src/System/Globalization/GregorianCalendarHelper.cs