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

[BUG] Incorrect relative date shown for planned payments

Open ynshung opened this issue 11 months ago • 6 comments

Please confirm the following

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

  1. Create a daily planned payments
  2. See the discrepancy in the main page

Expected behavior

The (today/tomorrow/yesterday) date should be correct.

Screenshots

IMG_20240322_132935 IMG_20240322_133004

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.

ynshung avatar Mar 22 '24 05:03 ynshung

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

Tagging @ILIYANGERMANOV for review & approval 👀

ivywallet avatar Mar 22 '24 05:03 ivywallet

That's a timezone issues

ILIYANGERMANOV avatar Mar 23 '24 20:03 ILIYANGERMANOV

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.

ynshung avatar Mar 27 '24 00:03 ynshung

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()?

beradeep avatar Mar 27 '24 20:03 beradeep

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()?

The proper fix would:

  1. Everything outside the Data layer should use Instant.
  2. The UI layer should convert the Instant -> LocalDateTime -> String (formatted)

ILIYANGERMANOV avatar Mar 27 '24 23:03 ILIYANGERMANOV

Why should we replace LocalDateTime with Instant? It works fine I guess.

beradeep avatar Mar 28 '24 06:03 beradeep