]> git.ktnx.net Git - mobile-ledger.git/commitdiff
NT model/setDate: replace empty dates with null
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Tue, 26 Nov 2019 22:04:19 +0000 (00:04 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Tue, 26 Nov 2019 22:04:19 +0000 (00:04 +0200)
app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionModel.java

index a2f356c68e6b44c42d7d1286c69812047648042f..39b9ac8ad60f09dd3b44eae84995870f9158ccf1 100644 (file)
@@ -378,6 +378,13 @@ public class NewTransactionModel extends ViewModel {
             this.date.setValue(date);
         }
         public void setDate(String text) {
+            if ((text == null) || text.trim()
+                                      .isEmpty())
+            {
+                setDate((Date) null);
+                return;
+            }
+
             int year, month, day;
             final Calendar c = GregorianCalendar.getInstance();
             Matcher m = reYMD.matcher(text);