2 *******************************************************************************
\r
3 * Copyright (C) 1996-2009, International Business Machines Corporation and *
\r
4 * others. All Rights Reserved. *
\r
5 *******************************************************************************
\r
7 package com.ibm.icu.util;
\r
8 import com.ibm.icu.util.TimeZone;
\r
9 import java.util.Date;
\r
10 import java.util.Locale;
\r
13 * <code>JapaneseCalendar</code> is a subclass of <code>GregorianCalendar</code>
\r
14 * that numbers years and eras based on the reigns of the Japanese emperors.
\r
15 * The Japanese calendar is identical to the Gregorian calendar in all respects
\r
16 * except for the year and era. The ascension of each emperor to the throne
\r
17 * begins a new era, and the years of that era are numbered starting with the
\r
18 * year of ascension as year 1.
\r
20 * Note that in the year of an imperial ascension, there are two possible sets
\r
21 * of year and era values: that for the old era and for the new. For example, a
\r
22 * new era began on January 7, 1989 AD. Strictly speaking, the first six days
\r
23 * of that year were in the Showa era, e.g. "January 6, 64 Showa", while the rest
\r
24 * of the year was in the Heisei era, e.g. "January 7, 1 Heisei". This class
\r
25 * handles this distinction correctly when computing dates. However, in lenient
\r
26 * mode either form of date is acceptable as input.
\r
28 * In modern times, eras have started on January 8, 1868 AD, Gregorian (Meiji),
\r
29 * July 30, 1912 (Taisho), December 25, 1926 (Showa), and January 7, 1989 (Heisei). Constants
\r
30 * for these eras, suitable for use in the <code>ERA</code> field, are provided
\r
31 * in this class. Note that the <em>number</em> used for each era is more or
\r
32 * less arbitrary. Currently, the era starting in 1053 AD is era #0; however this
\r
33 * may change in the future as we add more historical data. Use the predefined
\r
34 * constants rather than using actual, absolute numbers.
\r
36 * This class should not be subclassed.</p>
\r
38 * JapaneseCalendar usually should be instantiated using
\r
39 * {@link com.ibm.icu.util.Calendar#getInstance(ULocale)} passing in a <code>ULocale</code>
\r
40 * with the tag <code>"@calendar=japanese"</code>.</p>
\r
42 * @see com.ibm.icu.util.GregorianCalendar
\r
43 * @see com.ibm.icu.util.Calendar
\r
45 * @author Laura Werner
\r
49 public class JapaneseCalendar extends GregorianCalendar {
\r
50 // jdk1.4.2 serialver
\r
51 private static final long serialVersionUID = -2977189902603704691L;
\r
53 //-------------------------------------------------------------------------
\r
55 //-------------------------------------------------------------------------
\r
58 * Constructs a default <code>JapaneseCalendar</code> using the current time
\r
59 * in the default time zone with the default locale.
\r
62 public JapaneseCalendar() {
\r
67 * Constructs a <code>JapaneseCalendar</code> based on the current time
\r
68 * in the given time zone with the default locale.
\r
69 * @param zone the given time zone.
\r
72 public JapaneseCalendar(TimeZone zone) {
\r
77 * Constructs a <code>JapaneseCalendar</code> based on the current time
\r
78 * in the default time zone with the given locale.
\r
79 * @param aLocale the given locale.
\r
82 public JapaneseCalendar(Locale aLocale) {
\r
87 * Constructs a <code>JapaneseCalendar</code> based on the current time
\r
88 * in the default time zone with the given locale.
\r
89 * @param locale the given ulocale.
\r
92 public JapaneseCalendar(ULocale locale) {
\r
97 * Constructs a <code>JapaneseCalendar</code> based on the current time
\r
98 * in the given time zone with the given locale.
\r
100 * @param zone the given time zone.
\r
102 * @param aLocale the given locale.
\r
105 public JapaneseCalendar(TimeZone zone, Locale aLocale) {
\r
106 super(zone, aLocale);
\r
110 * Constructs a <code>JapaneseCalendar</code> based on the current time
\r
111 * in the given time zone with the given locale.
\r
113 * @param zone the given time zone.
\r
115 * @param locale the given ulocale.
\r
118 public JapaneseCalendar(TimeZone zone, ULocale locale) {
\r
119 super(zone, locale);
\r
123 * Constructs a <code>JapaneseCalendar</code> with the given date set
\r
124 * in the default time zone with the default locale.
\r
126 * @param date The date to which the new calendar is set.
\r
129 public JapaneseCalendar(Date date) {
\r
135 * Constructs a <code>JapaneseCalendar</code> with the given date set
\r
136 * in the default time zone with the default locale.
\r
138 * @param era The imperial era used to set the calendar's {@link #ERA ERA} field.
\r
139 * Eras are numbered starting with the Tenki era, which
\r
140 * began in 1053 AD Gregorian, as era zero. Recent
\r
141 * eras can be specified using the constants
\r
142 * {@link #MEIJI} (which started in 1868 AD),
\r
143 * {@link #TAISHO} (1912 AD),
\r
144 * {@link #SHOWA} (1926 AD), and
\r
145 * {@link #HEISEI} (1989 AD).
\r
147 * @param year The value used to set the calendar's {@link #YEAR YEAR} field,
\r
148 * in terms of the era.
\r
150 * @param month The value used to set the calendar's {@link #MONTH MONTH} field.
\r
151 * The value is 0-based. e.g., 0 for January.
\r
153 * @param date The value used to set the calendar's DATE field.
\r
156 public JapaneseCalendar(int era, int year, int month, int date) {
\r
157 super(year, month, date);
\r
162 * Constructs a <code>JapaneseCalendar</code> with the given date set
\r
163 * in the default time zone with the default locale.
\r
165 * @param year The value used to set the calendar's {@link #YEAR YEAR} field,
\r
166 * in the era Heisei, the most current at the time this
\r
167 * class was last updated.
\r
169 * @param month The value used to set the calendar's {@link #MONTH MONTH} field.
\r
170 * The value is 0-based. e.g., 0 for January.
\r
172 * @param date The value used to set the calendar's {@link #DATE DATE} field.
\r
175 public JapaneseCalendar(int year, int month, int date) {
\r
176 super(year, month, date);
\r
177 set(ERA, CURRENT_ERA);
\r
181 * Constructs a <code>JapaneseCalendar</code> with the given date
\r
182 * and time set for the default time zone with the default locale.
\r
184 * @param year The value used to set the calendar's {@link #YEAR YEAR} time field,
\r
185 * in the era Heisei, the most current at the time of this
\r
188 * @param month The value used to set the calendar's {@link #MONTH MONTH} time field.
\r
189 * The value is 0-based. e.g., 0 for January.
\r
191 * @param date The value used to set the calendar's {@link #DATE DATE} time field.
\r
193 * @param hour The value used to set the calendar's {@link #HOUR_OF_DAY HOUR_OF_DAY} time field.
\r
195 * @param minute The value used to set the calendar's {@link #MINUTE MINUTE} time field.
\r
197 * @param second The value used to set the calendar's {@link #SECOND SECOND} time field.
\r
200 public JapaneseCalendar(int year, int month, int date, int hour,
\r
201 int minute, int second)
\r
203 super(year, month, date, hour, minute, second);
\r
204 set(ERA, CURRENT_ERA);
\r
207 //-------------------------------------------------------------------------
\r
209 // Use 1970 as the default value of EXTENDED_YEAR
\r
210 private static final int GREGORIAN_EPOCH = 1970;
\r
215 protected int handleGetExtendedYear() {
\r
216 // EXTENDED_YEAR in JapaneseCalendar is a Gregorian year
\r
217 // The default value of EXTENDED_YEAR is 1970 (Showa 45)
\r
219 if (newerField(EXTENDED_YEAR, YEAR) == EXTENDED_YEAR &&
\r
220 newerField(EXTENDED_YEAR, ERA) == EXTENDED_YEAR) {
\r
221 year = internalGet(EXTENDED_YEAR, GREGORIAN_EPOCH);
\r
223 // extended year is a gregorian year, where 1 = 1AD, 0 = 1BC, -1 = 2BC, etc
\r
224 year = internalGet(YEAR, 1) // pin to minimum of year 1 (first year)
\r
225 + ERAS[internalGet(ERA, CURRENT_ERA) * 3] // add gregorian starting year
\r
226 - 1; // Subtract one because year starts at 1
\r
232 * Called by handleComputeJulianDay. Returns the default month (0-based) for the year,
\r
233 * taking year and era into account. Defaults to 0 (JANUARY) for Gregorian.
\r
234 * @param extendedYear the extendedYear, as returned by handleGetExtendedYear
\r
235 * @return the default month
\r
236 * @provisional ICU 3.6
\r
237 * @draft ICU 3.6 (retain)
\r
240 protected int getDefaultMonthInYear(int extendedYear)
\r
242 int era = internalGet(ERA, CURRENT_ERA);
\r
243 //computeFields(status); // No need to compute fields here - expect the caller already did so.
\r
245 // Find out if we are at the edge of an era
\r
246 if(extendedYear == ERAS[era*3]) {
\r
247 return ERAS[(era*3)+1] // month..
\r
248 -1; // return 0-based month
\r
250 return super.getDefaultMonthInYear(extendedYear);
\r
255 * Called by handleComputeJulianDay. Returns the default day (1-based) for the month,
\r
256 * taking currently-set year and era into account. Defaults to 1 for Gregorian.
\r
257 * @param extendedYear the extendedYear, as returned by handleGetExtendedYear
\r
258 * @param month the month, as returned by getDefaultMonthInYear
\r
259 * @return the default day of the month
\r
260 * @draft ICU 3.6 (retain)
\r
261 * @provisional ICU 3.6
\r
262 * @see #DAY_OF_MONTH
\r
264 protected int getDefaultDayInMonth(int extendedYear, int month) {
\r
265 int era = internalGet(ERA, CURRENT_ERA);
\r
267 if(extendedYear == ERAS[era*3]) { // if it is year 1..
\r
268 if(month == ((ERAS[(era*3)+1])-1)) { // if it is the emperor's first month..
\r
269 return ERAS[(era*3)+2]; // return the D_O_M of acession
\r
273 return super.getDefaultDayInMonth(extendedYear, month);
\r
279 protected void handleComputeFields(int julianDay) {
\r
280 super.handleComputeFields(julianDay);
\r
281 int year = internalGet(EXTENDED_YEAR);
\r
285 // Short circuit for recent years. Most modern computations will
\r
286 // occur in the current era and won't require the binary search.
\r
287 // Note that if the year is == the current era year, then we use
\r
288 // the binary search to handle the month/dom comparison.
\r
289 if (year > ERAS[ERAS.length - 3]) {
\r
293 int high = ERAS.length / 3;
\r
295 while (low < high - 1) {
\r
296 int i = (low + high) / 2;
\r
297 int diff = year - ERAS[i*3];
\r
299 // If years are the same, then compare the months, and if those
\r
300 // are the same, compare days of month. In the ERAS array
\r
301 // months are 1-based for easier maintenance.
\r
303 diff = internalGet(MONTH) - (ERAS[i*3 + 1] - 1);
\r
305 diff = internalGet(DAY_OF_MONTH) - ERAS[i*3 + 2];
\r
316 // Now we've found the last era that starts before this date, so
\r
317 // adjust the year to count from the start of that era. Note that
\r
318 // all dates before the first era will fall into the first era by
\r
320 internalSet(ERA, low);
\r
321 internalSet(YEAR, year - ERAS[low*3] + 1);
\r
324 private static final int[] ERAS = {
\r
325 // Gregorian date of each emperor's ascension
\r
326 // Years are AD, months are 1-based.
\r
328 645, 6, 19, // Taika
\r
329 650, 2, 15, // Hakuchi
\r
330 672, 1, 1, // Hakuho
\r
331 686, 7, 20, // Shucho
\r
332 701, 3, 21, // Taiho
\r
333 704, 5, 10, // Keiun
\r
334 708, 1, 11, // Wado
\r
335 715, 9, 2, // Reiki
\r
336 717, 11, 17, // Yoro
\r
337 724, 2, 4, // Jinki
\r
338 729, 8, 5, // Tempyo
\r
339 749, 4, 14, // Tempyo-kampo
\r
340 749, 7, 2, // Tempyo-shoho
\r
341 757, 8, 18, // Tempyo-hoji
\r
342 765, 1, 7, // Tempho-jingo
\r
343 767, 8, 16, // Jingo-keiun
\r
344 770, 10, 1, // Hoki
\r
345 781, 1, 1, // Ten-o
\r
346 782, 8, 19, // Enryaku
\r
347 806, 5, 18, // Daido
\r
348 810, 9, 19, // Konin
\r
349 824, 1, 5, // Tencho
\r
350 834, 1, 3, // Showa
\r
351 848, 6, 13, // Kajo
\r
352 851, 4, 28, // Ninju
\r
353 854, 11, 30, // Saiko
\r
354 857, 2, 21, // Tennan
\r
355 859, 4, 15, // Jogan
\r
356 877, 4, 16, // Genkei
\r
357 885, 2, 21, // Ninna
\r
358 889, 4, 27, // Kampyo
\r
359 898, 4, 26, // Shotai
\r
360 901, 7, 15, // Engi
\r
361 923, 4, 11, // Encho
\r
362 931, 4, 26, // Shohei
\r
363 938, 5, 22, // Tengyo
\r
364 947, 4, 22, // Tenryaku
\r
365 957, 10, 27, // Tentoku
\r
367 964, 7, 10, // Koho
\r
368 968, 8, 13, // Anna
\r
369 970, 3, 25, // Tenroku
\r
370 973, 12, 20, // Ten-en
\r
371 976, 7, 13, // Jogen
\r
372 978, 11, 29, // Tengen
\r
373 983, 4, 15, // Eikan
\r
374 985, 4, 27, // Kanna
\r
375 987, 4, 5, // Ei-en
\r
377 990, 11, 7, // Shoryaku
\r
378 995, 2, 22, // Chotoku
\r
379 999, 1, 13, // Choho
\r
380 1004, 7, 20, // Kanko
\r
381 1012, 12, 25, // Chowa
\r
382 1017, 4, 23, // Kannin
\r
383 1021, 2, 2, // Jian
\r
384 1024, 7, 13, // Manju
\r
385 1028, 7, 25, // Chogen
\r
386 1037, 4, 21, // Choryaku
\r
387 1040, 11, 10, // Chokyu
\r
388 1044, 11, 24, // Kantoku
\r
389 1046, 4, 14, // Eisho
\r
390 1053, 1, 11, // Tengi
\r
391 1058, 8, 29, // Kohei
\r
392 1065, 8, 2, // Jiryaku
\r
393 1069, 4, 13, // Enkyu
\r
394 1074, 8, 23, // Shoho
\r
395 1077, 11, 17, // Shoryaku
\r
396 1081, 2, 10, // Eiho
\r
397 1084, 2, 7, // Otoku
\r
398 1087, 4, 7, // Kanji
\r
399 1094, 12, 15, // Kaho
\r
400 1096, 12, 17, // Eicho
\r
401 1097, 11, 21, // Shotoku
\r
402 1099, 8, 28, // Kowa
\r
403 1104, 2, 10, // Choji
\r
404 1106, 4, 9, // Kasho
\r
405 1108, 8, 3, // Tennin
\r
406 1110, 7, 13, // Ten-ei
\r
407 1113, 7, 13, // Eikyu
\r
408 1118, 4, 3, // Gen-ei
\r
409 1120, 4, 10, // Hoan
\r
410 1124, 4, 3, // Tenji
\r
411 1126, 1, 22, // Daiji
\r
412 1131, 1, 29, // Tensho
\r
413 1132, 8, 11, // Chosho
\r
414 1135, 4, 27, // Hoen
\r
415 1141, 7, 10, // Eiji
\r
416 1142, 4, 28, // Koji
\r
417 1144, 2, 23, // Tenyo
\r
418 1145, 7, 22, // Kyuan
\r
419 1151, 1, 26, // Ninpei
\r
420 1154, 10, 28, // Kyuju
\r
421 1156, 4, 27, // Hogen
\r
422 1159, 4, 20, // Heiji
\r
423 1160, 1, 10, // Eiryaku
\r
425 1163, 3, 29, // Chokan
\r
426 1165, 6, 5, // Eiman
\r
427 1166, 8, 27, // Nin-an
\r
429 1171, 4, 21, // Shoan
\r
430 1175, 7, 28, // Angen
\r
431 1177, 8, 4, // Jisho
\r
432 1181, 7, 14, // Yowa
\r
433 1182, 5, 27, // Juei
\r
434 1184, 4, 16, // Genryuku
\r
435 1185, 8, 14, // Bunji
\r
436 1190, 4, 11, // Kenkyu
\r
437 1199, 4, 27, // Shoji
\r
438 1201, 2, 13, // Kennin
\r
439 1204, 2, 20, // Genkyu
\r
440 1206, 4, 27, // Ken-ei
\r
441 1207, 10, 25, // Shogen
\r
442 1211, 3, 9, // Kenryaku
\r
443 1213, 12, 6, // Kenpo
\r
444 1219, 4, 12, // Shokyu
\r
445 1222, 4, 13, // Joo
\r
446 1224, 11, 20, // Gennin
\r
447 1225, 4, 20, // Karoku
\r
448 1227, 12, 10, // Antei
\r
449 1229, 3, 5, // Kanki
\r
450 1232, 4, 2, // Joei
\r
451 1233, 4, 15, // Tempuku
\r
452 1234, 11, 5, // Bunryaku
\r
453 1235, 9, 19, // Katei
\r
454 1238, 11, 23, // Ryakunin
\r
455 1239, 2, 7, // En-o
\r
456 1240, 7, 16, // Ninji
\r
457 1243, 2, 26, // Kangen
\r
458 1247, 2, 28, // Hoji
\r
459 1249, 3, 18, // Kencho
\r
460 1256, 10, 5, // Kogen
\r
461 1257, 3, 14, // Shoka
\r
462 1259, 3, 26, // Shogen
\r
463 1260, 4, 13, // Bun-o
\r
464 1261, 2, 20, // Kocho
\r
465 1264, 2, 28, // Bun-ei
\r
466 1275, 4, 25, // Kenji
\r
467 1278, 2, 29, // Koan
\r
468 1288, 4, 28, // Shoo
\r
469 1293, 8, 55, // Einin
\r
470 1299, 4, 25, // Shoan
\r
471 1302, 11, 21, // Kengen
\r
472 1303, 8, 5, // Kagen
\r
473 1306, 12, 14, // Tokuji
\r
474 1308, 10, 9, // Enkei
\r
475 1311, 4, 28, // Ocho
\r
476 1312, 3, 20, // Showa
\r
477 1317, 2, 3, // Bunpo
\r
478 1319, 4, 28, // Geno
\r
479 1321, 2, 23, // Genkyo
\r
480 1324, 12, 9, // Shochu
\r
481 1326, 4, 26, // Kareki
\r
482 1329, 8, 29, // Gentoku
\r
483 1331, 8, 9, // Genko
\r
484 1334, 1, 29, // Kemmu
\r
485 1336, 2, 29, // Engen
\r
486 1340, 4, 28, // Kokoku
\r
487 1346, 12, 8, // Shohei
\r
488 1370, 7, 24, // Kentoku
\r
489 1372, 4, 1, // Bunch\u0169
\r
490 1375, 5, 27, // Tenju
\r
491 1379, 3, 22, // Koryaku
\r
492 1381, 2, 10, // Kowa
\r
493 1384, 4, 28, // Gench\u0169
\r
494 1384, 2, 27, // Meitoku
\r
495 1387, 8, 23, // Kakei
\r
497 1390, 3, 26, // Meitoku
\r
499 1428, 4, 27, // Shocho
\r
500 1429, 9, 5, // Eikyo
\r
501 1441, 2, 17, // Kakitsu
\r
502 1444, 2, 5, // Bun-an
\r
503 1449, 7, 28, // Hotoku
\r
504 1452, 7, 25, // Kyotoku
\r
505 1455, 7, 25, // Kosho
\r
506 1457, 9, 28, // Choroku
\r
507 1460, 12, 21, // Kansho
\r
508 1466, 2, 28, // Bunsho
\r
509 1467, 3, 3, // Onin
\r
510 1469, 4, 28, // Bunmei
\r
511 1487, 7, 29, // Chokyo
\r
512 1489, 8, 21, // Entoku
\r
513 1492, 7, 19, // Meio
\r
514 1501, 2, 29, // Bunki
\r
515 1504, 2, 30, // Eisho
\r
516 1521, 8, 23, // Taiei
\r
517 1528, 8, 20, // Kyoroku
\r
518 1532, 7, 29, // Tenmon
\r
519 1555, 10, 23, // Koji
\r
520 1558, 2, 28, // Eiroku
\r
521 1570, 4, 23, // Genki
\r
522 1573, 7, 28, // Tensho
\r
523 1592, 12, 8, // Bunroku
\r
524 1596, 10, 27, // Keicho
\r
525 1615, 7, 13, // Genwa
\r
526 1624, 2, 30, // Kan-ei
\r
527 1644, 12, 16, // Shoho
\r
528 1648, 2, 15, // Keian
\r
529 1652, 9, 18, // Shoo
\r
530 1655, 4, 13, // Meiryaku
\r
531 1658, 7, 23, // Manji
\r
532 1661, 4, 25, // Kanbun
\r
533 1673, 9, 21, // Enpo
\r
534 1681, 9, 29, // Tenwa
\r
535 1684, 2, 21, // Jokyo
\r
536 1688, 9, 30, // Genroku
\r
537 1704, 3, 13, // Hoei
\r
538 1711, 4, 25, // Shotoku
\r
539 1716, 6, 22, // Kyoho
\r
540 1736, 4, 28, // Genbun
\r
541 1741, 2, 27, // Kanpo
\r
542 1744, 2, 21, // Enkyo
\r
543 1748, 7, 12, // Kan-en
\r
544 1751, 10, 27, // Horyaku
\r
545 1764, 6, 2, // Meiwa
\r
546 1772, 11, 16, // An-ei
\r
547 1781, 4, 2, // Tenmei
\r
548 1789, 1, 25, // Kansei
\r
549 1801, 2, 5, // Kyowa
\r
550 1804, 2, 11, // Bunka
\r
551 1818, 4, 22, // Bunsei
\r
552 1830, 12, 10, // Tenpo
\r
553 1844, 12, 2, // Koka
\r
554 1848, 2, 28, // Kaei
\r
555 1854, 11, 27, // Ansei
\r
556 1860, 3, 18, // Man-en
\r
557 1861, 2, 19, // Bunkyu
\r
558 1864, 2, 20, // Genji
\r
559 1865, 4, 7, // Keio
\r
560 1868, 9, 8, // Meiji
\r
561 1912, 7, 30, // Taisho
\r
562 1926, 12, 25, // Showa
\r
563 1989, 1, 8, // Heisei
\r
566 //-------------------------------------------------------------------------
\r
567 // Public constants for some of the recent eras that folks might use...
\r
568 //-------------------------------------------------------------------------
\r
570 // Constant for the current era. This must be regularly updated.
\r
574 static public final int CURRENT_ERA = (ERAS.length / 3) - 1;
\r
577 * Constant for the era starting on Sept. 8, 1868 AD.
\r
580 static public final int MEIJI = CURRENT_ERA - 3;
\r
583 * Constant for the era starting on July 30, 1912 AD.
\r
586 static public final int TAISHO = CURRENT_ERA - 2;
\r
589 * Constant for the era starting on Dec. 25, 1926 AD.
\r
592 static public final int SHOWA = CURRENT_ERA - 1;
\r
595 * Constant for the era starting on Jan. 7, 1989 AD.
\r
598 static public final int HEISEI = CURRENT_ERA;
\r
601 * Override GregorianCalendar. We should really handle YEAR_WOY and
\r
602 * EXTENDED_YEAR here too to implement the 1..5000000 range, but it's
\r
606 protected int handleGetLimit(int field, int limitType) {
\r
609 if (limitType == MINIMUM || limitType == GREATEST_MINIMUM) {
\r
612 return CURRENT_ERA;
\r
615 switch (limitType) {
\r
617 case GREATEST_MINIMUM:
\r
619 case LEAST_MAXIMUM:
\r
622 return super.handleGetLimit(field, MAXIMUM) - ERAS[CURRENT_ERA*3];
\r
626 return super.handleGetLimit(field, limitType);
\r
634 public String getType() {
\r
642 public int getActualMaximum(int field) {
\r
643 if (field == YEAR) {
\r
644 int era = get(Calendar.ERA);
\r
645 if (era == CURRENT_ERA) {
\r
646 // TODO: Investigate what value should be used here - revisit after 4.0.
\r
647 return handleGetLimit(YEAR, MAXIMUM);
\r
649 int nextEraYear = ERAS[(era+1)*3];
\r
650 int nextEraMonth = ERAS[(era+1)*3 + 1];
\r
651 int nextEraDate = ERAS[(era+1)*3 + 2];
\r
653 int maxYear = nextEraYear - ERAS[era*3] + 1; // 1-base
\r
654 if (nextEraMonth == 1 && nextEraDate == 1) {
\r
655 // Substract 1, because the next era starts at Jan 1
\r
661 return super.getActualMaximum(field);
\r