]> git.ktnx.net Git - mobile-ledger.git/commitdiff
month is counted from 0, it seems
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Fri, 30 Nov 2018 17:56:31 +0000 (17:56 +0000)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Fri, 30 Nov 2018 17:56:31 +0000 (17:56 +0000)
app/src/main/java/net/ktnx/mobileledger/DatePickerFragment.java

index 4ea1f8b3d228c1b394344cb66faa947cda431068..7aa2db06b1bc1ae626ceb0fd3dae58fde65a3c8c 100644 (file)
@@ -35,14 +35,14 @@ implements DatePickerDialog.OnDateSetListener
         Matcher m_mon_day = re_mon_day.matcher(present);
 
         if (m_mon_day.matches()) {
-            month = Integer.parseInt(m_mon_day.group(0));
-            day = Integer.parseInt(m_mon_day.group(1));
+            month = Integer.parseInt(m_mon_day.group(1))-1;
+            day = Integer.parseInt(m_mon_day.group(2));
         }
         else {
             Pattern re_day = Pattern.compile("^\\s*(\\d{1,2})\\s*$");
             Matcher m_day = re_day.matcher(present);
             if (m_day.matches()) {
-                day = Integer.parseInt(m_day.group(0));
+                day = Integer.parseInt(m_day.group(1));
             }
         }
 
@@ -58,7 +58,7 @@ implements DatePickerDialog.OnDateSetListener
             date.setText(String.format(Locale.US, "%d", day));
         }
         else {
-            date.setText(String.format(Locale.US, "%d/%d", month, day));
+            date.setText(String.format(Locale.US, "%d/%d", month+1, day));
         }
     }
 }