From: Damyan Ivanov Date: Tue, 26 Nov 2019 22:04:19 +0000 (+0200) Subject: NT model/setDate: replace empty dates with null X-Git-Tag: v0.11.0~10 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=54e204dbd812a622745677849e1dec9210d1d926;p=mobile-ledger.git NT model/setDate: replace empty dates with null --- diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionModel.java b/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionModel.java index a2f356c6..39b9ac8a 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionModel.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionModel.java @@ -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);