ivy-wallet icon indicating copy to clipboard operation
ivy-wallet copied to clipboard

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

Open parampatil opened this issue 1 year ago • 4 comments

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

parampatil avatar Sep 11 '24 17:09 parampatil

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

Tagging @ILIYANGERMANOV for review & approval 👀

ivywallet avatar Sep 11 '24 17:09 ivywallet

@parampatil I am not able to reproduce the issue

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

akashs056 avatar Sep 12 '24 09:09 akashs056

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

ebarruel avatar Sep 27 '24 03:09 ebarruel

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)
                })

jayc1299 avatar Oct 21 '24 20:10 jayc1299