@SuppressWarnings("deprecation") @Test public void earliestPossibleDateIsCorrect() { Assert.assertEquals(new Date(95, 2, 3), new PhenoTipsDate("1995-03-03").toEarliestPossibleISODate()); Assert.assertEquals(new Date(95, 2, 1), new PhenoTipsDate("1995-03").toEarliestPossibleISODate()); Assert.assertEquals(new Date(95, 0, 1), new PhenoTipsDate("1995").toEarliestPossibleISODate()); Assert.assertEquals(new Date(90, 0, 1), new PhenoTipsDate("1990s").toEarliestPossibleISODate()); Assert.assertNull(new PhenoTipsDate("").toEarliestPossibleISODate()); }
public Date toEarliestPossibleISODate() { if (this.year == null) { return null; } int earliestMonth = (this.month == null) ? 1 : this.month; int earliestDay = (this.day == null || this.month == null) ? 1 : this.day; Calendar calendar = Calendar.getInstance(); calendar.set(this.year, earliestMonth - 1, earliestDay, 0, 0, 0); calendar.set(Calendar.MILLISECOND, 0); return calendar.getTime(); }
PhenoTipsDate { public Date toEarliestPossibleISODate() { if (this.year == null) { return null; } int earliestMonth = (this.month == null) ? 1 : this.month; int earliestDay = (this.day == null || this.month == null) ? 1 : this.day; Calendar calendar = Calendar.getInstance(); calendar.set(this.year, earliestMonth - 1, earliestDay, 0, 0, 0); calendar.set(Calendar.MILLISECOND, 0); return calendar.getTime(); } }
PhenoTipsDate { public Date toEarliestPossibleISODate() { if (this.year == null) { return null; } int earliestMonth = (this.month == null) ? 1 : this.month; int earliestDay = (this.day == null || this.month == null) ? 1 : this.day; Calendar calendar = Calendar.getInstance(); calendar.set(this.year, earliestMonth - 1, earliestDay, 0, 0, 0); calendar.set(Calendar.MILLISECOND, 0); return calendar.getTime(); } PhenoTipsDate(Date date);  PhenoTipsDate(JSONObject jsonFuzzyDate);  PhenoTipsDate(String phenoTipsDateString); }
PhenoTipsDate { public Date toEarliestPossibleISODate() { if (this.year == null) { return null; } int earliestMonth = (this.month == null) ? 1 : this.month; int earliestDay = (this.day == null || this.month == null) ? 1 : this.day; Calendar calendar = Calendar.getInstance(); calendar.set(this.year, earliestMonth - 1, earliestDay, 0, 0, 0); calendar.set(Calendar.MILLISECOND, 0); return calendar.getTime(); } PhenoTipsDate(Date date);  PhenoTipsDate(JSONObject jsonFuzzyDate);  PhenoTipsDate(String phenoTipsDateString); JSONObject toJSON(); Date toEarliestPossibleISODate(); @Override String toString(); String toYYYYMMDDString(); boolean isSet(); }
PhenoTipsDate { public Date toEarliestPossibleISODate() { if (this.year == null) { return null; } int earliestMonth = (this.month == null) ? 1 : this.month; int earliestDay = (this.day == null || this.month == null) ? 1 : this.day; Calendar calendar = Calendar.getInstance(); calendar.set(this.year, earliestMonth - 1, earliestDay, 0, 0, 0); calendar.set(Calendar.MILLISECOND, 0); return calendar.getTime(); } PhenoTipsDate(Date date);  PhenoTipsDate(JSONObject jsonFuzzyDate);  PhenoTipsDate(String phenoTipsDateString); JSONObject toJSON(); Date toEarliestPossibleISODate(); @Override String toString(); String toYYYYMMDDString(); boolean isSet(); static final String JSON_YEAR_FIELDNAME; static final String JSON_MONTH_FIELDNAME; static final String JSON_DAY_FIELDNAME; static final String JSON_RANGE_FIELDNAME; static final String JSON_RANGE_YEARS; static final Pattern DATE_STRING_REGEXP; }