/** * This will round out a date to a precision based on the input string. We need to do this to be * more meaningful to the user when the type in x = '2011-10-13'. * * @param returnDate the parsed data in its specific form * @param acceptedFormat the format we used to * @param dateString * @return */ private DateRange toPrecision(Date returnDate, String acceptedFormat, String dateString) { Precision precision = null; if (YYYY_MM_DD_HH_MM1.equals(acceptedFormat) || YYYY_MM_DD_HH_MM2.equals(acceptedFormat)) { precision = Precision.MINUTES; } else if (YYYY_MM_DD1.equals(acceptedFormat) || YYYY_MM_DD2.equals(acceptedFormat)) { precision = Precision.DAYS; } else if (ATLASSIAN_DURATION.equals(acceptedFormat)) { // ok its an atlassian duration precision = reverseParseAtlassianDuration(dateString.toLowerCase(Locale.ENGLISH)); } if (precision != null) { return precision.createRange(returnDate, timeZoneManager.getLoggedInUserTimeZone()); } else { // Is this even possible? probably not but here we are so something sensible return new DateRange(returnDate, returnDate); } }