private static DateTime parseEndDate(String value, boolean resolve) throws ParseException { DateTime end; try { end = new DateTime(value.substring(value.indexOf('/') + 1)); } catch (ParseException e) { if (resolve) { final TemporalAmount duration = parseDuration(value).getDuration(); end = new DateTime(Date.from(parseStartDate(value).toInstant().plus(duration))); } else { throw e; } } return end; }
private static DateTime parseEndDate(String value, boolean resolve) throws ParseException { DateTime end; try { end = new DateTime(value.substring(value.indexOf('/') + 1)); } catch (ParseException e) { if (resolve) { final TemporalAmount duration = parseDuration(value).getDuration(); end = new DateTime(Date.from(parseStartDate(value).toInstant().plus(duration))); } else { throw e; } } return end; }
private static DateTime parseEndDate(String value, boolean resolve) throws ParseException { DateTime end = null; try { end = new DateTime(value.substring(value.indexOf('/') + 1)); } catch (ParseException e) { if (resolve) { final Dur duration = parseDuration(value); end = new DateTime(duration.getTime(parseStartDate(value))); } else { throw e; } } return end; }
private static DateTime parseEndDate(String value, boolean resolve) throws ParseException { DateTime end; try { end = new DateTime(value.substring(value.indexOf('/') + 1)); } catch (ParseException e) { if (resolve) { final Dur duration = parseDuration(value); end = new DateTime(duration.getTime(parseStartDate(value))); } else { throw e; } } return end; }
private static DateTime parseEndDate(String value, boolean resolve) throws ParseException { DateTime end; try { end = new DateTime(value.substring(value.indexOf('/') + 1)); } catch (ParseException e) { if (resolve) { final Dur duration = parseDuration(value); end = new DateTime(duration.getTime(parseStartDate(value))); } else { throw e; } } return end; }
/** * Constructor. * * @param aValue * a string representation of a period * @throws ParseException * where the specified string is not a valid representation */ public Period(final String aValue) throws ParseException { super(parseStartDate(aValue), parseEndDate(aValue, true)); // period may end in either a date-time or a duration.. try { parseEndDate(aValue, false); } catch (ParseException pe) { // duration = DurationFormat.getInstance().parse(aValue); duration = parseDuration(aValue); } normalise(); }
/** * Constructor. * * @param aValue * a string representation of a period * @throws ParseException * where the specified string is not a valid representation */ public Period(final String aValue) throws ParseException { super(parseStartDate(aValue), parseEndDate(aValue, true)); // period may end in either a date-time or a duration.. try { parseEndDate(aValue, false); } catch (ParseException pe) { // duration = DurationFormat.getInstance().parse(aValue); duration = parseDuration(aValue); } normalise(); }
/** * Constructor. * * @param aValue * a string representation of a period * @throws ParseException * where the specified string is not a valid representation */ public Period(final String aValue) throws ParseException { super(parseStartDate(aValue), parseEndDate(aValue, true)); // period may end in either a date-time or a duration.. try { parseEndDate(aValue, false); } catch (ParseException pe) { // duration = DurationFormat.getInstance().parse(aValue); duration = parseDuration(aValue); } normalise(); }
/** * Constructor. * * @param aValue * a string representation of a period * @throws ParseException * where the specified string is not a valid representation */ public Period(final String aValue) throws ParseException { super(parseStartDate(aValue), parseEndDate(aValue, true)); // period may end in either a date-time or a duration.. try { parseEndDate(aValue, false); } catch (ParseException pe) { // duration = DurationFormat.getInstance().parse(aValue); duration = parseDuration(aValue); } normalise(); }
/** * Constructor. * * @param aValue * a string representation of a period * @throws ParseException * where the specified string is not a valid representation */ public Period(final String aValue) throws ParseException { super(parseStartDate(aValue), parseEndDate(aValue, true)); // period may end in either a date-time or a duration.. try { parseEndDate(aValue, false); } catch (ParseException pe) { // duration = DurationFormat.getInstance().parse(aValue); duration = parseDuration(aValue); } normalise(); }