NT: fix month interpretation when formatting calendar date
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 24 Nov 2019 11:13:11 +0000 (13:13 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 24 Nov 2019 11:13:11 +0000 (13:13 +0200)
app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionModel.java

index e1166b2..4c200fc 100644 (file)
@@ -444,11 +444,11 @@ public class NewTransactionModel extends ViewModel {
             final int myDay = c.get(Calendar.DAY_OF_MONTH);
 
             if (today.get(Calendar.YEAR) != myYear) {
-                return String.format(Locale.US, "%d/%02d/%02d", myYear, myMonth, myDay);
+                return String.format(Locale.US, "%d/%02d/%02d", myYear, myMonth + 1, myDay);
             }
 
             if (today.get(Calendar.MONTH) != myMonth) {
-                return String.format(Locale.US, "%d/%02d", myMonth, myDay);
+                return String.format(Locale.US, "%d/%02d", myMonth + 1, myDay);
             }
 
             return String.valueOf(myDay);