Long hours = copy.remove(HOURS);
Long minutes = copy.remove(MINUTES);
Long seconds = copy.remove(SECONDS);
Long nanos = copy.remove(NANOS);
if (copy.size() > 0) {
throw new CalendarConversionException(
"Unable to convert to a Period as the following fields are incompatible: " + copy.keySet());
}
return Period.period(
years == null ? 0 : MathUtils.safeToInt(years),
months == null ? 0 : MathUtils.safeToInt(months),