NIFI-13557 Corrected Date Time Matcher to support single digit months

This closes #9094

Signed-off-by: David Handermann <exceptionfactory@apache.org>
This commit is contained in:
dan-s1 2024-07-19 13:34:26 +00:00 committed by exceptionfactory
parent 36b9edd862
commit 059a3b7745
No known key found for this signature in database
2 changed files with 3 additions and 1 deletions

View File

@ -384,7 +384,7 @@ public class RegexDateTimeMatcher implements DateTimeMatcher {
}
private void addShortMonth() {
patterns.add("(?:0[1-9]|1[0-2])");
patterns.add("(?:0?[1-9]|1[0-2])");
range = range.plus(1, 2);
}

View File

@ -34,6 +34,8 @@ public class TestRegexDateTimeMatcher {
exampleToPattern.put("2018/12/12", "yyyy/MM/dd");
exampleToPattern.put("12/12/2018", "MM/dd/yyyy");
exampleToPattern.put("12/12/18", "MM/dd/yy");
exampleToPattern.put("1/1/18", "M/d/yy");
exampleToPattern.put("1/10/18", "M/d/yy");
exampleToPattern.put("1:40:55", "HH:mm:ss");
exampleToPattern.put("01:0:5", "HH:mm:ss");
exampleToPattern.put("12/12/2018 13:04:08 GMT-05:00", "MM/dd/yyyy HH:mm:ss z");