@Test void calculateLowerDateShouldReturnDateUpToThePreviousDayUsingDayUnit() { assertThat(DateResolutionFormatter.computeLowerDate(date, SearchQuery.DateResolution.Day)) .isEqualTo("2014-01-02T00:00:00Z"); }
public static ZonedDateTime computeLowerDate(ZonedDateTime date, SearchQuery.DateResolution resolution) { switch (resolution) { case Year: return date.truncatedTo(ChronoUnit.DAYS).withDayOfYear(1); case Month: return date.truncatedTo(ChronoUnit.DAYS).withDayOfMonth(1); default: return date.truncatedTo(convertDateResolutionField(resolution)); } }
DateResolutionFormatter { public static ZonedDateTime computeLowerDate(ZonedDateTime date, SearchQuery.DateResolution resolution) { switch (resolution) { case Year: return date.truncatedTo(ChronoUnit.DAYS).withDayOfYear(1); case Month: return date.truncatedTo(ChronoUnit.DAYS).withDayOfMonth(1); default: return date.truncatedTo(convertDateResolutionField(resolution)); } } }
DateResolutionFormatter { public static ZonedDateTime computeLowerDate(ZonedDateTime date, SearchQuery.DateResolution resolution) { switch (resolution) { case Year: return date.truncatedTo(ChronoUnit.DAYS).withDayOfYear(1); case Month: return date.truncatedTo(ChronoUnit.DAYS).withDayOfMonth(1); default: return date.truncatedTo(convertDateResolutionField(resolution)); } }  }
DateResolutionFormatter { public static ZonedDateTime computeLowerDate(ZonedDateTime date, SearchQuery.DateResolution resolution) { switch (resolution) { case Year: return date.truncatedTo(ChronoUnit.DAYS).withDayOfYear(1); case Month: return date.truncatedTo(ChronoUnit.DAYS).withDayOfMonth(1); default: return date.truncatedTo(convertDateResolutionField(resolution)); } }  static ZonedDateTime computeUpperDate(ZonedDateTime date, SearchQuery.DateResolution resolution); static ZonedDateTime computeLowerDate(ZonedDateTime date, SearchQuery.DateResolution resolution); static ZonedDateTime convertDateToZonedDateTime(Date date); }
DateResolutionFormatter { public static ZonedDateTime computeLowerDate(ZonedDateTime date, SearchQuery.DateResolution resolution) { switch (resolution) { case Year: return date.truncatedTo(ChronoUnit.DAYS).withDayOfYear(1); case Month: return date.truncatedTo(ChronoUnit.DAYS).withDayOfMonth(1); default: return date.truncatedTo(convertDateResolutionField(resolution)); } }  static ZonedDateTime computeUpperDate(ZonedDateTime date, SearchQuery.DateResolution resolution); static ZonedDateTime computeLowerDate(ZonedDateTime date, SearchQuery.DateResolution resolution); static ZonedDateTime convertDateToZonedDateTime(Date date);  }