* January 3, then the era index for Heisei is returned. If the
* given date is not in any transition month, then -1 is returned.
*/
private static int getTransitionEraIndex(LocalGregorianCalendar.Date date) {
int eraIndex = getEraIndex(date);
CalendarDate transitionDate = eras[eraIndex].getSinceDate();
if (transitionDate.getYear() == date.getNormalizedYear() &&
transitionDate.getMonth() == date.getMonth()) {
return eraIndex;
}
if (eraIndex < eras.length - 1) {
transitionDate = eras[++eraIndex].getSinceDate();
if (transitionDate.getYear() == date.getNormalizedYear() &&
transitionDate.getMonth() == date.getMonth()) {
return eraIndex;
}
}
return -1;
}