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.000ZAfter
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.
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.