Skip to content

Commit 3b0c2d2

Browse files
committed
Changed check for time
Signed-off-by: Guian Gumpac <[email protected]>
1 parent 467d033 commit 3b0c2d2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

opensearch/src/main/java/org/opensearch/sql/opensearch/data/type/OpenSearchDateType.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,13 +229,15 @@ private ExprCoreType getExprTypeFromCustomFormatString(String formatString) {
229229
boolean isTime = false;
230230

231231
try {
232+
// Dates will always have "year" in the formatter string
232233
isDate = formats.stream()
233234
.anyMatch(format -> DateTimeFormatter.ofPattern(format).toString().toLowerCase().contains("year"));
234235
} catch (IllegalArgumentException ignore) {
235236
}
236237
try {
238+
// Times will always have "hour" in the formatter string
237239
isTime = formats.stream()
238-
.anyMatch(format -> DateTimeFormatter.ofPattern(formatString).toString().toLowerCase().contains("minute"));
240+
.anyMatch(format -> DateTimeFormatter.ofPattern(format).toString().toLowerCase().contains("hour"));
239241
} catch (IllegalArgumentException ignore) {
240242
}
241243

0 commit comments

Comments
 (0)