Skip to content

Commit ed836dd

Browse files
authored
fix: prevent crash/empty wheels at unknown locale (#650)
- prevent empty wheels when unknown locale passed - support Luxembourgish (lb) locale
1 parent 5ebae5b commit ed836dd

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

.maestro/display-text.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,13 @@ appId: com.rn069
5656
- assertVisible:
5757
id: dateStringOutput
5858
text: 'CN 2 thg 11200 SA '
59+
60+
# Should be possible to use picker with invalid locale
61+
- runFlow: utils/launch.yml
62+
- runFlow:
63+
file: utils/change-prop.yml
64+
env:
65+
PROP: locale
66+
VALUE: xx
67+
- runFlow: utils/swipe-wheel-1.yml
68+
- assertVisible: '2000-01-02 00:00:00'

android/src/main/java/com/henninghall/date_picker/Formats.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ public static String get(String locale, Format format) throws FormatNotFoundExce
8484
put("kn", mapOf("EEE, d MMM", "d", "y"));
8585
put("ko", mapOf("MMM d일 EEE", "d일", "y년"));
8686
put("ky", mapOf("d-MMM, EEE", "d", "y"));
87+
put("lb", mapOf("EEE d MMM", "d", "y"));
8788
put("ln", mapOf("EEE d MMM", "d", "y"));
8889
put("lo", mapOf("EEE d MMM", "d", "y"));
8990
put("lt", mapOf("MM-dd, EEE", "dd", "y"));

android/src/main/java/com/henninghall/date_picker/LocaleUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ private static String getFormat(String languageTag, Formats.Format format) {
3030
try {
3131
String firstPartOfLanguageTag = languageTag.substring(0, languageTag.indexOf("_"));
3232
return Formats.get(firstPartOfLanguageTag, format);
33-
} catch (Formats.FormatNotFoundException ex) {
33+
} catch (Formats.FormatNotFoundException | IndexOutOfBoundsException ex) {
3434
return Formats.defaultFormat.get(format);
3535
}
3636
}

0 commit comments

Comments
 (0)