From: Damyan Ivanov Date: Fri, 30 Nov 2018 17:56:31 +0000 (+0000) Subject: month is counted from 0, it seems X-Git-Tag: v0.3~375 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=df957964a684943af44a013c8020463fbf7e8f93;p=mobile-ledger.git month is counted from 0, it seems --- diff --git a/app/src/main/java/net/ktnx/mobileledger/DatePickerFragment.java b/app/src/main/java/net/ktnx/mobileledger/DatePickerFragment.java index 4ea1f8b3..7aa2db06 100644 --- a/app/src/main/java/net/ktnx/mobileledger/DatePickerFragment.java +++ b/app/src/main/java/net/ktnx/mobileledger/DatePickerFragment.java @@ -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)); } } }