From 8c06316cc32b20db0c6b89261997779f5d59b499 Mon Sep 17 00:00:00 2001 From: jungsehui Date: Fri, 20 Mar 2026 23:17:41 +0900 Subject: [PATCH] fix(rc): Set explicit English locale for date parsing Fixes #1196 --- .../google/firebase/remoteconfig/RemoteConfigUtil.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/google/firebase/remoteconfig/RemoteConfigUtil.java b/src/main/java/com/google/firebase/remoteconfig/RemoteConfigUtil.java index 4011af8ff..5b7b5aaba 100644 --- a/src/main/java/com/google/firebase/remoteconfig/RemoteConfigUtil.java +++ b/src/main/java/com/google/firebase/remoteconfig/RemoteConfigUtil.java @@ -23,6 +23,7 @@ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; +import java.util.Locale; import java.util.TimeZone; final class RemoteConfigUtil { @@ -53,7 +54,7 @@ static long convertToMilliseconds(String dateString) throws ParseException { static String convertToUtcZuluFormat(long millis) { // sample output date string: 2020-11-12T22:12:02.000000000Z checkArgument(millis >= 0, "Milliseconds duration must not be negative"); - SimpleDateFormat dateFormat = new SimpleDateFormat(ZULU_DATE_PATTERN); + SimpleDateFormat dateFormat = new SimpleDateFormat(ZULU_DATE_PATTERN, Locale.ENGLISH); dateFormat.setTimeZone(UTC_TIME_ZONE); return dateFormat.format(new Date(millis)); } @@ -61,7 +62,7 @@ static String convertToUtcZuluFormat(long millis) { static String convertToUtcDateFormat(long millis) { // sample output date string: Tue, 08 Dec 2020 15:49:51 GMT checkArgument(millis >= 0, "Milliseconds duration must not be negative"); - SimpleDateFormat dateFormat = new SimpleDateFormat(UTC_DATE_PATTERN); + SimpleDateFormat dateFormat = new SimpleDateFormat(UTC_DATE_PATTERN, Locale.ENGLISH); dateFormat.setTimeZone(UTC_TIME_ZONE); return dateFormat.format(new Date(millis)); } @@ -78,7 +79,8 @@ static long convertFromUtcZuluFormat(String dateString) throws ParseException { if (indexOfPeriod != -1) { dateString = dateString.substring(0, indexOfPeriod); } - SimpleDateFormat dateFormat = new SimpleDateFormat(ZULU_DATE_NO_FRAC_SECS_PATTERN); + SimpleDateFormat dateFormat = + new SimpleDateFormat(ZULU_DATE_NO_FRAC_SECS_PATTERN, Locale.ENGLISH); dateFormat.setTimeZone(UTC_TIME_ZONE); return dateFormat.parse(dateString).getTime(); } @@ -86,7 +88,7 @@ static long convertFromUtcZuluFormat(String dateString) throws ParseException { static long convertFromUtcDateFormat(String dateString) throws ParseException { // sample input date string: Tue, 08 Dec 2020 15:49:51 GMT checkArgument(!Strings.isNullOrEmpty(dateString), "Date string must not be null or empty"); - SimpleDateFormat dateFormat = new SimpleDateFormat(UTC_DATE_PATTERN); + SimpleDateFormat dateFormat = new SimpleDateFormat(UTC_DATE_PATTERN, Locale.ENGLISH); dateFormat.setTimeZone(UTC_TIME_ZONE); return dateFormat.parse(dateString).getTime(); }