1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-24 08:38:51 -05:00

Fixed DateFormatValidator to handle placeholders SHORT and MEDIUM

This commit is contained in:
cketti 2011-09-30 16:54:01 +02:00
parent cd72e197ec
commit 6e1bf2965d

View File

@ -191,6 +191,13 @@ public class GlobalSettings {
@Override
public boolean isValid(String key, String value, Map<String, String> validatedSettings) {
try {
// The placeholders "SHORT" and "MEDIUM" are fine.
if (DateFormatter.SHORT_FORMAT.equals(value) ||
DateFormatter.MEDIUM_FORMAT.equals(value)) {
return true;
}
// If the SimpleDateFormat constructor doesn't throw an exception, we're good.
new SimpleDateFormat(value);
return true;
} catch (Exception e) {