Skip to content

Conversation

@yuvalt
Copy link

@yuvalt yuvalt commented Feb 6, 2025

I'm in New York timezone, and that could be the reason why I see this issue. When the data is inserted to the database, it is in UTC. However due to the way the code is written, it will not actually dequeue until five hours later because of timezone issues in the code. My change fixes that (I verified). You should consider removing the timezone config option which way probably a way to try and resolve the issue... setting the timezone on the entire database is too intrusive, imho.

@yuvalt yuvalt mentioned this pull request Feb 6, 2025
@mgcrea
Copy link
Owner

mgcrea commented Feb 6, 2025

Hi, thanks for the PR!

The issue that I see is that having mismatched timezone does lead to other issues like having @default(now()) (which is the recommended prisma-way) to be incorrect since it uses the database time (unless I'm mistaken).

Agree that I don't really like the alignTimezone option which feels a bit hacky. But not really sure yet what is best. Did this option work for your use-case?

Will investigate a bit more,

@noxify
Copy link

noxify commented Feb 6, 2025

Haven't tested it directly with prisma ( via @default), but could something like this solve the problem?

timezone('utc', now())

We're using this in our trigger logic while creating the audit records and previously we had the problem, that the timestamp ( via now() ) was in our local time zone and not utc.

@yuvalt
Copy link
Author

yuvalt commented Feb 8, 2025

Hi, thanks for the PR!

The issue that I see is that having mismatched timezone does lead to other issues like having @default(now()) (which is the recommended prisma-way) to be incorrect since it uses the database time (unless I'm mistaken).

Agree that I don't really like the alignTimezone option which feels a bit hacky. But not really sure yet what is best. Did this option work for your use-case?

Will investigate a bit more,

I tried to set the timezone option and it didn't work actually.

@yuvalt
Copy link
Author

yuvalt commented Feb 21, 2025

Hello @mgcrea -- did you get a chance to think about this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants