Skip to content

Commit 868699c

Browse files
authored
Update date format warning regex with more text specifiers (#113001) (#113010)
1 parent dc32b36 commit 868699c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

server/src/main/java/org/elasticsearch/common/time/DateUtils.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,8 +389,9 @@ public static ZonedDateTime nowWithMillisResolution(Clock clock) {
389389
}
390390

391391
// check for all textual fields, and localized zone offset
392+
// the weird thing with Z is to ONLY match 4 in a row, with no Z before or after (but those groups can also be empty)
392393
private static final Predicate<String> CONTAINS_CHANGING_TEXT_SPECIFIERS = System.getProperty("java.locale.providers", "")
393-
.contains("COMPAT") ? Pattern.compile("[EcGaO]|MMM|LLL|eee|ccc|QQQ|ZZZZ").asPredicate() : Predicates.never();
394+
.contains("COMPAT") ? Pattern.compile("[BEGOavz]|LLL|MMM|QQQ|ccc|eee|(?<!Z)Z{4}(?!Z)").asPredicate() : Predicates.never();
394395

395396
@UpdateForV9 // this can be removed, we will only use CLDR on v9
396397
static void checkTextualDateFormats(String format) {

0 commit comments

Comments
 (0)