Class DateTimePatterns
java.lang.Object
io.github.connellite.util.internal.dateparse.DateTimePatterns
Safety net for inputs
DateTimeScanner does not recognise, such as signed or expanded
years.
Formatters are probed with DateTimeFormatter.parseUnresolved(CharSequence, ParsePosition),
which reports a mismatch by returning null instead of throwing, so a failing input costs
no exceptions. Resolution and range validation are done by ParsedFields, because
parseUnresolved deliberately skips both.
This is the last remaining piece of the previous shotgun approach that walked a list of
DateTimeFormatters (comparable to what araddon/dateparse explicitly avoids — see
ParseAny).
It only runs when the scanner returns false.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanparse(CharSequence text, int start, int end, ParsedFields out) Tries every fallback formatter againsttextbetweenstartandend.
-
Constructor Details
-
DateTimePatterns
public DateTimePatterns()
-
-
Method Details
-
parse
Tries every fallback formatter againsttextbetweenstartandend.- Returns:
truewhen one of them consumed the whole range and produced usable fields; whenfalseis returned the contents ofoutare undefined
-