/** Constructor for a range of dates, beginning at date start and finishing at date end */ public ISODateInstance(ISODateInstance start, ISODateInstance end) { String startString = start.getDateString(); if (start.isRange()) { startString = start.getStartDate(); } String endString = end.getDateString(); if (end.isRange()) { endString = end.getEndDate(); } isoDate = startString + '/' + endString; unparseable = (start.isUnparseable() || end.isUnparseable()); }
public boolean isCompatibleDate(ISODateInstance other) { if (this.isUnparseable() || other.isUnparseable()) { return this.isoDate.equals(other.isoDate); } // first see if either is a range if (this.isRange()) { return this.contains(other); } else if (other.isRange()) { return false; // not compatible if other is range and this isn't } else { return isCompatible(isoDate, other.getDateString()); } }