_guessingEarly = guessingEarly;
}
@Override
public NSTimestamp parseObject(String text) throws ParseException {
NSTimestamp parsedTimestamp = null;
try {
// Attempt to parse the string with the given pattern.
Date parsedDate = super.parse(text);
parsedTimestamp = new NSTimestamp(parsedDate);
}
catch (ParseException e) {
// If the input doesn't match the pattern, use Chronic to parse the
// input.
Span span = Chronic.parse(text, options());
if (span == null) {
throw e;
}
if (span.isSingularity() || isGuessingEarly()) {
parsedTimestamp = new NSTimestamp(span.getBeginCalendar().getTime());
}
else {
parsedTimestamp = new NSTimestamp(span.getEndCalendar().getTime());
}
}
return parsedTimestamp;
}