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

[BUG] Transaction being added to the wrong date after changing time (timezone issue)

Open rekcrimson opened this issue 1 year ago • 11 comments

Please confirm the following

Describe the bug

Al querer configurar la hora en los registros de gastos e ingresos, si selecciono una hora después de las 6:00pm lo marca automáticamente como si la transacción se hubiera hecho el día siguiente.

To Reproduce

  1. Agregar gasto.
  2. Seleccionar cuenta.
  3. Ingresar monto.
  4. Clic en botón "Ingresar".
  5. Seleccionar categoría.
  6. Ingresar título del gasto.
  7. Configurar el día en el calendario.
  8. Configurar hora.
  9. Si la hora es después de las 18:00 aparece el bug, ya que la transacción se convierte y queda en la fecha del día siguiente y no en el seleccionado.

Expected behavior

Que la hora y fecha queden como debe ser de acuerdo a lo configurado. Este bug no ocurría en la versión anterior.

Screenshots

Screenshot_2024-04-10-16-14-19-154_com ivy wallet Screenshot_2024-04-10-16-14-24-172_com ivy wallet

App version

4.6.2 from Google Play Store for Android

Smartphone

Xiaomi Redmi Note 10S

Additional context

No response

rekcrimson avatar Apr 10 '24 21:04 rekcrimson

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

Tagging @ILIYANGERMANOV for review & approval 👀

ivywallet avatar Apr 10 '24 21:04 ivywallet

Hello @rekcrimson thanks for reporting! Would you translate it to English? I don't understand Spanish and also most contributors won't be able to

ILIYANGERMANOV avatar Apr 10 '24 21:04 ILIYANGERMANOV

I can reproduce the issue as well. In short try the following to reproduce the issue: Add an expense, set any value and jump to the datetime control. It shows 10 Apr but after changing only the time e.g. to 6pm the date jumps to 11 Apr. The expense is then saved with date 11 Apr and not 10 Apr as intended. @rekcrimson screenshots show the issue

Btw, is there any chance to get 24h clock back instead of 12 hour clock? Had the 24h clock until the new update

faerbersteve avatar Apr 11 '24 01:04 faerbersteve

Thanks for translating @faerbersteve! Can you create an separate issue for the 12/24 clock to be shown depending on user's Android system settings?

ILIYANGERMANOV avatar Apr 11 '24 07:04 ILIYANGERMANOV

It's timezones issues. We don't treat transactions time properly.

ILIYANGERMANOV avatar Apr 11 '24 07:04 ILIYANGERMANOV

I'm on it

ILIYANGERMANOV avatar Apr 11 '24 07:04 ILIYANGERMANOV

Thank you for your interest @ILIYANGERMANOV! 🎉 Issue #3118 is assigned to you. You can work on it! ✅

If you don't want to work on it now, please un-assign yourself so other contributors can take it.

Also, make sure to read our Contribution Guidelines.

ivywallet avatar Apr 11 '24 07:04 ivywallet

@ILIYANGERMANOV I want to work on this, Can you give me an idea how we want to solve this problem? How do you want to save time etc, what will be the impact of change on other functionalities?

Vivekban avatar May 01 '24 11:05 Vivekban

Hey @Vivekban yes, here's how to fix it:

  1. Change TransactionsEntity and DB time to Instant
  2. Convert Instant to formatted local datetime only in the UI layer
  3. Add a FormatTimeUseCase in ":shared:ui:core" that turns an Instant (UTC) to formatted String in local time
  4. Update VM's to use the new use-case

Logic:

  • Everything in the DB and domain logic is in UTC (Instant) => no time zones
  • When all computations are done the UI layer converts the UTC time into user's local
  • Note: You might also need to update the Date/Time pickers

Does that helps?

ILIYANGERMANOV avatar May 01 '24 11:05 ILIYANGERMANOV

I'm on it

Vivekban avatar May 01 '24 11:05 Vivekban

Thank you for your interest @Vivekban! 🎉 Issue #3118 is assigned to you. You can work on it! ✅

If you don't want to work on it now, please un-assign yourself so other contributors can take it.

Also, make sure to read our Contribution Guidelines.

ivywallet avatar May 01 '24 11:05 ivywallet

Should be fixed in https://github.com/Ivy-Apps/ivy-wallet/pull/3224

ILIYANGERMANOV avatar Jun 02 '24 09:06 ILIYANGERMANOV