Ivy-Apps / ivy-wallet

Ivy Wallet is an open-source money manager app for Android, no longer maintained. You can fork the code or download the final version from Google Play.
https://play.google.com/store/apps/details?id=com.ivy.wallet
GNU General Public License v3.0
2.8k stars 675 forks source link

[BUG] The selected date is always one day earlier than intended #3495

Open parampatil opened 2 months ago

parampatil commented 2 months ago

Please confirm the following

Describe the bug

https://github.com/user-attachments/assets/6342bd35-bca9-4384-8dcd-0b950f68a221

There is an error in the date picker functionality The selected date is always one day earlier than intended The problem occurs when a user chooses a specific date

The issue persists on adding income, adding expense and the date displayed on dashboard for the added entry.

To Reproduce

  1. Create a new expense
  2. Select account and add the amount as usual
  3. Click on date picker and select a date

Expected behavior

The date selected by user should be displayed in the entry as well as dashboard.

Screenshots

No response

App version

v2024.09.01 (196)

Smartphone

Xiaomi 11 Lite NE 5G Android 14 - HyperOS 1.0.5.0

Additional context

No response

ivywallet commented 2 months ago

Thank you @parampatil for raising Issue #3495! 🚀 What's next? Read our Contribution Guidelines 📚.

Tagging @ILIYANGERMANOV for review & approval 👀

akashs056 commented 2 months ago

@parampatil I am not able to reproduce the issue

https://github.com/user-attachments/assets/d623203d-3658-49e5-bc5f-177429bb9c6a

ebarruel commented 1 month ago

I am also able to reproduce this bug with app version 2024.09.22 (199) on a OnePlus 7 Pro (Android 12).

jayc1299 commented 3 weeks ago

This can be replicated when the phone time zone isn't UTC.

The class AndroidDateTimePicker converts the user selected time to LocalDate before returning. I would have thought it would be preferable to only convert dates when displaying.

....Trying to find a fix.

ConfirmButton(onClick = {
                    datePickerViewState = null
                    pickerState.selectedDateMillis?.let(Instant::ofEpochMilli)
                        ?.let {
                            with(timeConverter) { it.toLocalDate() }
                    }?.let(viewState.onDatePicked)
                })