Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing timezone #761

Closed
wants to merge 1 commit into from
Closed

Fix missing timezone #761

wants to merge 1 commit into from

Conversation

ekzyis
Copy link
Member

@ekzyis ekzyis commented Jan 17, 2024

This might explain why I've been seeing different stats in the calendar vs when I count my posts using my profile.

It seems to calculate the stats using a different time zone then I am providing via the frontend (local dates get converted to unix timestamps) vs which time zone is used in the profile on the frontend. I don't think this necessarily fixes this issue but at least this PR gets the ball rolling regarding discussing this issue.

So I am not sure if we really want to fix the timezone here. But since it's code running on the server, it should have a fixed timezone anyway for everyone. So in the end, this shouldn't change anything? This time zone stuff is really confusing lol. Need to think more about this thus I'll keep this as a draft for now.


Additionally, withClause which is used for our charts also does not use timezone($1) but might make sense to keep it there as is since it's isolated and I am not aware of any existing confusion there.


I also found out that we're using data types with no time zone for our Item table because that's the data type Prisma maps DateTime to by default..

I don't think that's what we want. I think one should always store timestamp with time zone (timestamptz).

                                              Table "public.Item"
      Column       |              Type              | Collation | Nullable |              Default
-------------------+--------------------------------+-----------+----------+------------------------------------
 id                | integer                        |           | not null | nextval('"Item_id_seq"'::regclass)
 created_at        | timestamp(3) without time zone |           | not null | CURRENT_TIMESTAMP
 updated_at        | timestamp(3) without time zone |           | not null | CURRENT_TIMESTAMP

kind of using this pull request to summarize somewhere all confusing stuff I found related to time.

@ekzyis ekzyis added the bug label Jan 17, 2024
@ekzyis ekzyis changed the title Fix timezone confusion Fix missing timezone Jan 17, 2024
@ekzyis ekzyis marked this pull request as draft January 17, 2024 20:01
@ekzyis ekzyis closed this Apr 5, 2024
@ekzyis ekzyis deleted the fix-missing-timezone branch April 5, 2024 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant