From 54e204dbd812a622745677849e1dec9210d1d926 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Wed, 27 Nov 2019 00:04:19 +0200 Subject: [PATCH] NT model/setDate: replace empty dates with null --- .../ktnx/mobileledger/ui/activity/NewTransactionModel.java | 7 +++++++ 1 file changed, 7 insertions(+) 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); -- 2.39.5