ivy-wallet
ivy-wallet copied to clipboard
[BUG] Incorrect relative date shown for planned payments
Please confirm the following
- [X] I checked the current issues for duplicate problems
Describe the bug
The day (yesterday/today/tomorrow) date is incorrect for planned payments.
The date when the screenshot is taken is 22/3/2024 and you can see at the bottom is correctly written as "Today", but you can see the discrepancy with the overdue planned payments date writes "Yesterday". It also applies to upcoming payment as shown in the second screenshot which shows Today's date incorrectly.
To Reproduce
- Create a daily planned payments
- See the discrepancy in the main page
Expected behavior
The (today/tomorrow/yesterday) date should be correct.
Screenshots
Smartphone
Poco F3, MIUI 14.0.8, Android 13
Additional context
In the screenshot, the 22/3/2024 planned payment should not be overdue as well since the day is not passed yet.
Thank you @ynshung for raising Issue #3033! 🚀 What's next? Read our Contribution Guidelines 📚.
Tagging @ILIYANGERMANOV for review & approval 👀
That's a timezone issues
Observation: At a UTC+8 time zone, when the time is before 0800 this bug will occur but in opposite way which is today shown as "Tomorrow". After the time it becomes the correct time i.e. today correctly labelled as "Today".
So probably after 1600 the bug will occur like shown in the screenshot where today will be shown as "Yesterday".
This probably means that the planned payments does not follow the time zone in the device but instead the GMT / UTC+0.
This issue is occurring because we are using dateTimeUTC()
in most of the date format functions
. @ILIYANGERMANOV I think should we change all references of dateTimeUTC()
to dateTimeLocal()
?
This issue is occurring because we are using
dateTimeUTC()
in most of thedate format functions
. @ILIYANGERMANOV I think should we change all references ofdateTimeUTC()
todateTimeLocal()
?
The proper fix would:
- Everything outside the Data layer should use
Instant
. - The UI layer should convert the
Instant
->LocalDateTime
->String
(formatted)
Why should we replace LocalDateTime
with Instant
? It works fine I guess.