diff --git a/src/main/java/teammates/common/util/StringHelper.java b/src/main/java/teammates/common/util/StringHelper.java index 653b52a7d9a..b955b54b23c 100644 --- a/src/main/java/teammates/common/util/StringHelper.java +++ b/src/main/java/teammates/common/util/StringHelper.java @@ -1,6 +1,7 @@ package teammates.common.util; import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; import java.util.Collections; import java.util.List; import java.util.Objects; @@ -179,7 +180,9 @@ public static String toString(List list, String delimiter) { * Converts a double value between 0 and 1 to 3dp-string. */ public static String toDecimalFormatString(double doubleVal) { - DecimalFormat df = new DecimalFormat("0.###"); + DecimalFormatSymbols syms = new DecimalFormatSymbols(); + syms.setDecimalSeparator('.'); + DecimalFormat df = new DecimalFormat("0.###", syms); return df.format(doubleVal); } diff --git a/src/main/java/teammates/common/util/TimeHelper.java b/src/main/java/teammates/common/util/TimeHelper.java index de7d58f796a..f3a5ed482a4 100644 --- a/src/main/java/teammates/common/util/TimeHelper.java +++ b/src/main/java/teammates/common/util/TimeHelper.java @@ -7,6 +7,7 @@ import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; import java.time.format.DateTimeParseException; +import java.util.Locale; /** * A helper class to hold time-related functions (e.g., converting dates to strings etc.). @@ -105,7 +106,9 @@ public static String formatInstant(Instant instant, String timeZone, String patt if (zonedDateTime.getHour() == 12 && zonedDateTime.getMinute() == 0) { processedPattern = pattern.replace("a", "'NOON'"); } - DateTimeFormatter formatter = DateTimeFormatter.ofPattern(processedPattern); + DateTimeFormatter formatter = DateTimeFormatter + .ofPattern(processedPattern) + .withLocale(Locale.US); return zonedDateTime.format(formatter); }