ananthakumaran / paisa

Paisa – Personal Finance Manager. https://paisa.fyi demo: https://demo.paisa.fyi
https://paisa.fyi
GNU Affero General Public License v3.0
2.24k stars 111 forks source link

Dates in display are offset by 1 due to timezones #162

Closed heliedharia closed 5 months ago

heliedharia commented 5 months ago

Describe your Environment OS: Synology DSM Paisa Version: 0.6.4 App Variant: CLI (dockerhub version) Notes:

Describe the bug Timezone issues seem to be causing dates to be displayed incorrectly.

To Reproduce

  1. Create a new entry in the ledger for 2024/01/01 (using this as an easy example; it's happening for all dates)
  2. Navigate to the dashboard and view Recent Transactions, OR hover over a specific Budget item to view the list of transactions, OR navigate to the Transactions page
  3. View the date associated with the new transaction. It will show as 2023/12/31.

Expected behavior The date shown should match the date that was input in the ledger (2024/01/01).

Screenshots Ledger entries showing correct dates:

image

Transactions displayed when hovering over budget, showing incorrect dates:

image

Transactions displayed in the transactions page, showing incorrect dates:

image

Comments When I changed the my device timezone to UTC-0 or UTC+5.5, the issue ceased to occur. I am guessing the dates are being interpreted as datetimes that are then adjusted to match the local timezone. Since we are behind UTC, the dates are pushed back a day.

ananthakumaran commented 5 months ago

App Variant: CLI (dockerhub version) Running paisa on a Synology NAS and accessing it via multiple desktop and mobile devices. Issue is occurring on all devices

Paisa might not work correctly if the timezone is different on the device and the server. Paisa assumes all the dates are in the server timezone, since you run the dockerhub image it would be UTC, and your device is doing a UTC to local timezone conversion.

A quick fix would be to set the env explicitly in the docker image (example below)

FROM ananthakumaran/paisa
RUN apk add --no-cache tzdata
ENV TZ=Asia/Kolkata

I will add the tzdata package in the next release, so you will be able to just set the env variable -e 'TZ=Asia/Kolkata'. It doesn't work with the current dockerhub image because tzdata is not installed and golang seems to be always using UTC.

PS: Remember to do Sync Journal after fixing the timezone on the server, the dates are computed during sync.

heliedharia commented 5 months ago

@ananthakumaran Amazing, thanks! Will hold off on the quick fix since I don't want to mess around with editing the docker image myself 😅. Already have the env var set up, so all set to accept the tzdata package as soon as you release. This is the only hiccup with getting paisa set up so far. The visuals are great!

ananthakumaran commented 5 months ago

0.6.5 is now available, let me know if it fixes the issue. There is also a timezone config option available on the configuration page.

heliedharia commented 5 months ago

@ananthakumaran Thanks for the update! Yes, I saw it came through last night, and it is working correctly now!