Browse Source

Fix return of wrong pattern piece

The getPatternIncluding method would return quoted pieces if
the check contents of the quoted part included the format letter.

For instance for Danish (da_DK), the pattern is "EEE 'den' d. MMM"
If we are calling `getPatternIncluding("d", "da_DK")`, the method
would return `"den'"´, but we would like to return `"d."`.

This commit ignores pieces with apostrophe ("'") in them.
master
Mats Byrkjeland 5 years ago
parent
commit
481cf76fe3
1 changed files with 1 additions and 3 deletions
  1. +1
    -3
      android/src/main/java/com/henninghall/date_picker/LocaleUtils.java

+ 1
- 3
android/src/main/java/com/henninghall/date_picker/LocaleUtils.java View File

@ -17,7 +17,7 @@ public class LocaleUtils {
*/ */
public static String getPatternIncluding(String format, Locale locale) { public static String getPatternIncluding(String format, Locale locale) {
for (String piece: getFullPatternPieces(locale)){ for (String piece: getFullPatternPieces(locale)){
if(piece.contains(format)) {
if(piece.contains(format) && !piece.contains("'")) {
return piece; return piece;
} }
} }
@ -50,5 +50,3 @@ public class LocaleUtils {
} }
} }

Loading…
Cancel
Save