Run npm run all
and check the result. The Prisma Client misunderstands the datetime value generated by the dbgenerated("NOW()")
. When I run select now()
inside the db, I get the correct valued (in UTC). For example: 2023-05-17 16:49:33.898203 +00:00
.
Mac Mini 2018 (Intel)
- OS: MacOS 13.3.1 (a)
- PostgreSQL (local): PostgreSQL 14.8 on aarch64-apple-darwin20.6.0, compiled by Apple clang version 12.0.5 (clang-1205.0.22.9), 64-bit
- Node: v20.1.0
- NPM: 9.6.6
MacBook Pro M1 Max (ARM)
- OS: MacOS 13.3.1 (a)
- PostgreSQL (local): PostgreSQL 14.7 on aarch64-apple-darwin20.6.0, compiled by Apple clang version 12.0.5 (clang-1205.0.22.9), 64-bit
- Node: v20.1.0
- NPM: 9.6.7
Windows PC
- OS: Windows 10 22H2
- PostgreSQL (local): PostgreSQL 12.4, compiled by Visual C++ build 1914, 64-bit
- Node: v20.2.0
- NPM: 9.6.6
Mac Mini 2018 (Intel) Results:
1. Testing default
Prisma now(): Fri May 19 2023 23:10:39 GMT+0600 (East Kazakhstan Time)
Postgres now(): Sat May 20 2023 05:10:39 GMT+0600 (East Kazakhstan Time)
The difference: 06:00:00 hours / 21600002 ms
2. Testing manual
Manual: Fri May 19 2023 23:10:39 GMT+0600 (East Kazakhstan Time)
Postgres now(): Sat May 20 2023 05:10:39 GMT+0600 (East Kazakhstan Time)
The difference: 06:00:00 hours / 21600002 ms
3. Manually assigning both properties
Manual: Fri May 19 2023 23:10:39 GMT+0600 (East Kazakhstan Time)
Postgres now(): Fri May 19 2023 23:10:39 GMT+0600 (East Kazakhstan Time)
The difference: 00:00:00 hours / 0 ms
Data in the database:
id,prismaNow,dbNow
1,2023-05-19 17:10:39.942,2023-05-19 23:10:39.944
2,2023-05-19 17:10:39.951,2023-05-19 23:10:39.953
3,2023-05-19 17:10:39.953,2023-05-19 17:10:39.953
Testing now() in the database:
select now()
2023-05-19 17:05:51.532245 +00:00
Running date
from the Terminal:
Fri 19 May 2023 23:07:45 +06
MacBook Pro M1 Max (ARM) Results:
1. Testing default
Prisma now(): Fri May 19 2023 23:34:40 GMT+0600 (East Kazakhstan Time)
Postgres now(): Sat May 20 2023 00:34:40 GMT+0600 (East Kazakhstan Time)
The difference: 01:00:00 hours / 3600000 ms
2. Testing manual
Manual: Fri May 19 2023 23:34:40 GMT+0600 (East Kazakhstan Time)
Postgres now(): Sat May 20 2023 00:34:40 GMT+0600 (East Kazakhstan Time)
The difference: 01:00:00 hours / 3600001 ms
3. Manually assigning both properties
Manual: Fri May 19 2023 23:34:40 GMT+0600 (East Kazakhstan Time)
Postgres now(): Fri May 19 2023 23:34:40 GMT+0600 (East Kazakhstan Time)
The difference: 00:00:00 hours / 0 ms
Data in the database:
id,prismaNow,dbNow
1,2023-05-19 17:34:40.954,2023-05-19 18:34:40.954
2,2023-05-19 17:34:40.958,2023-05-19 18:34:40.959
3,2023-05-19 17:34:40.959,2023-05-19 17:34:40.959
Testing now() in the database:
select now()
2023-05-19 17:35:42.365372 +00:00
Running date
from the Terminal:
Fri 19 May 2023 23:36:00 +06
Windows PC Results:
1. Testing default
Prisma now(): Fri May 19 2023 23:21:14 GMT+0600 (East Kazakhstan Time)
Postgres now(): Sat May 20 2023 05:21:14 GMT+0600 (East Kazakhstan Time)
The difference: 06:00:00 hours / 21600005 ms
2. Testing manual
Manual: Fri May 19 2023 23:21:14 GMT+0600 (East Kazakhstan Time)
Postgres now(): Sat May 20 2023 05:21:14 GMT+0600 (East Kazakhstan Time)
The difference: 06:00:00 hours / 21600002 ms
3. Manually assigning both properties
Manual: Fri May 19 2023 23:21:14 GMT+0600 (East Kazakhstan Time)
Postgres now(): Fri May 19 2023 23:21:14 GMT+0600 (East Kazakhstan Time)
The difference: 00:00:00 hours / 0 ms
Data in the database:
id,prismaNow,dbNow
1,2023-05-19 17:21:14.546,2023-05-19 23:21:14.551
2,2023-05-19 17:21:14.569,2023-05-19 23:21:14.571
3,2023-05-19 17:21:14.572,2023-05-19 17:21:14.572
Testing now() in the database:
select now()
2023-05-19 17:24:29.266302 +00:00
Running date
from the MS Terminal (PowerShell Core):
19 May 2023 23:27:04
And running Get-TimeZone
:
Id : Central Asia Standard Time
HasIanaId : False
DisplayName : (UTC+06:00) Nur-Sultan
StandardName : Central Asia Standard Time
DaylightName : Central Asia Summer Time
BaseUtcOffset : 06:00:00
SupportsDaylightSavingTime : False