Skip to content

gorm seems has a bug on time with timezone #219

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

Closed
cnlangzi opened this issue Jun 21, 2021 · 3 comments
Closed

gorm seems has a bug on time with timezone #219

cnlangzi opened this issue Jun 21, 2021 · 3 comments
Assignees
Labels
bug Something isn't working ready-on-dayi/main

Comments

@cnlangzi
Copy link
Contributor

cnlangzi commented Jun 21, 2021

The connection can't be deleted.

We have two timezone now. One is postgres's , another is golang's.

In postgres, column may have a default value with now() (eg. allocation_connections.create_at). The timezone is set with postgres timezone.
In golang, we may upload some column with time.Now() (eg. allocation_connections.update_at). the timezone is set with golang timezone(it also is server's timezone)

there are two solutions:

  • should all time should be converted with a default timezone on postgres? if yes, what is the timezone . It is UTC ?
  • should globalization feature be implemented? time should be converted in different timezones automatically.

2021-06-21 03:06:43.899692 +0000 UTC > 2021-06-21 10:20:23.844087 +0800 CST m=-3564.945252206

Screen Shot 2021-06-21 at 11 24 21 AM

Screen Shot 2021-06-21 at 11 25 47 AM

@andrenerd
Copy link
Contributor

Imho, we should stick to UTC only. So the first proposed approach to be implemented.

ps. as you have already tracked the issue down and proposed the solution, could you assigned the issue to yourself. thanks.

@andrenerd andrenerd added the bug Something isn't working label Jun 25, 2021
@cnlangzi cnlangzi assigned cnlangzi and unassigned andrenerd and Sriep Jun 25, 2021
@cnlangzi
Copy link
Contributor Author

@andrenerd OK. leave it with me. thanks.

@cnlangzi
Copy link
Contributor Author

cnlangzi commented Oct 2, 2021

it is fixed on #344

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ready-on-dayi/main
Projects
None yet
Development

No branches or pull requests

3 participants