msgbyte / tianji

Tianji: Insight into everything, Website Analytics + Uptime Monitor + Server Status. not only another GA alternatives
https://tianji.msgbyte.com/
Apache License 2.0
1.61k stars 93 forks source link

fix: UTC Date Handling for Public Status Pages #121

Closed tommy141x closed 3 weeks ago

tommy141x commented 3 weeks ago

Prisma appears to automatically casts dates to UTC by default, which can lead to inconsistencies in date display, especially when working across timezones. By formatting the date as a string within the query, we can prevent Prisma from applying this UTC transformation.

Before Dates were output in UTC format: 2024-10-29T00:00:00.000Z After Dates are now output in the intended local format: 2024-10-29

Resolved Issue This discrepancy was noticed when viewing public status pages: data from 10-29 was sent under the date 10-28, even though the workspace and database share the same timezone settings. This PR ensures the dates are consistent with the workspace timezone configuration by removing the UTC cast.

Note This only fixes the function used by the public status page, and I am unsure if this same issue exists elsewhere.

moonrailgun commented 3 weeks ago

ic, looks cool.