Skip to content

Commit

Permalink
early draft of Korean calendar
Browse files Browse the repository at this point in the history
see issue #722
  • Loading branch information
MenoData committed Feb 5, 2018
1 parent b5737ed commit 1ed9418
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions calendar/src/main/java/net/time4j/calendar/KoreanCalendar.java
Original file line number Diff line number Diff line change
Expand Up @@ -469,12 +469,8 @@ public static KoreanCalendar of(
int dayOfMonth
) {

int extYear = year.getElapsedCyclicYears() + 1;
int cycle = MathUtils.floorDivide(extYear - 1, 60) + 1;
int yearOfCycle = MathUtils.floorModulo(extYear, 60);
if (yearOfCycle == 0) {
yearOfCycle = 60;
}
int cycle = year.getCycle();
int yearOfCycle = year.getYearOfCycle().getNumber();
return KoreanCalendar.of(cycle, yearOfCycle, month, dayOfMonth);

}
Expand Down Expand Up @@ -506,28 +502,27 @@ public static KoreanCalendar nowInSystemTime() {
/**
* <p>Queries if given parameter values form a well defined calendar date. </p>
*
* @param cycle the count of sexagesimal year cycles
* @param yearOfCycle the year of associated sexagesimal cycle
* @param year the year to be checked
* @param month the month to be checked
* @param dayOfMonth the day of month to be checked
* @return {@code true} if valid else {@code false}
* @return {@code true} if valid else {@code false}
*/
/*[deutsch]
* <p>Pr&uuml;ft, ob die angegebenen Parameter ein wohldefiniertes Kalenderdatum beschreiben. </p>
*
* @param cycle the count of sexagesimal year cycles
* @param yearOfCycle the year of associated sexagesimal cycle
* @param year the year to be checked
* @param month the month to be checked
* @param dayOfMonth the day of month to be checked
* @return {@code true} if valid else {@code false}
* @return {@code true} if valid else {@code false}
*/
public static boolean isValid(
int cycle,
int yearOfCycle,
EastAsianYear year,
EastAsianMonth month,
int dayOfMonth
) {

int cycle = year.getCycle();
int yearOfCycle = year.getYearOfCycle().getNumber();
return CALSYS.isValid(cycle, yearOfCycle, month, dayOfMonth);

}
Expand Down

0 comments on commit 1ed9418

Please sign in to comment.