public boolean isDateBased() { if (myChronoUnit != null) { return myChronoUnit.isDateBased(); } else { // QUARTER return true; } }
public boolean isDateBased() { if (myChronoUnit != null) { return myChronoUnit.isDateBased(); } else { // QUARTER return true; } }
/** * Checks if the duration of the unit is an estimate. * <p> * All time units in this class are considered to be accurate, while all date * units in this class are considered to be estimated. * <p> * This definition ignores leap seconds, but considers that Days vary due to * daylight saving time and months have different lengths. * * @return true if the duration is estimated, false if accurate */ @Override public boolean isDurationEstimated() { return isDateBased() || this == FOREVER; }
@Override public boolean isSupportedBy(Temporal temporal) { if (this == FOREVER) { return false; } if (temporal instanceof ChronoLocalDate) { return isDateBased(); } if (temporal instanceof ChronoLocalDateTime || temporal instanceof ChronoZonedDateTime) { return true; } try { temporal.plus(1, this); return true; } catch (RuntimeException ex) { try { temporal.plus(-1, this); return true; } catch (RuntimeException ex2) { return false; } } }