GORM Playground Link
https://github.com/go-gorm/playground/pull/465 https://github.com/jsgoupil/gorm/commit/95f580725520d37f146585ceb36c9efc37ced2c3
Description
The ExplainSQL does not display the time zone when displaying a time. The following times,
now := time.Now()
nowInPST := now.In(pst)
nowInEST := now.In(est)
are all equivalent. However, when you display the SQL, they will appear to be different.
What is saved in the database is correct; it's only what is in the ExplainSQL that doesn't work.
I added 2 time zones because one can pass if your computer is in that time zone. I am in PST, so it works, but it will fail with the EST.
sql_test.go:118: Explain SQL #8 expects
create table users (name, age, height, actived, bytes, create_at, update_at, deleted_at, email, role, pass) values ("jinzhu?", 1, 999.990000, true, "12345", "2020-02-23 11:10:10", "2020-02-23 11:10:10", NULL, "w@g.\"com", "admin", "pass"),
but got
create table users (name, age, height, actived, bytes, create_at, update_at, deleted_at, email, role, pass) values ("jinzhu?", 1, 999.990000, true, "12345", "2020-02-23 14:10:10", "2020-02-23 11:10:10", NULL, "w@g.\"com", "admin", "pass")
Comment From: holicc
you mean like this ?
create table users (name, age, height, actived, bytes, create_at, update_at, deleted_at, email, role, pass) values ("jinzhu?", 1, 999.990000, true, "12345", "2020-02-22 19:10:10 PST", "2020-02-23 11:10:10 CST", NULL, "w@g.\"com", "admin", "pass")
Comment From: jsgoupil
I would prefer the offset rather than time zone abbreviation, since it can be different based on the real "time zone" and the DST.
Comment From: a631807682
Maybe we need to add config to ExplainSQL/Explain to support hidden sql vars or define time output format, but this is a breaking change.
related to https://github.com/go-gorm/gorm/issues/5287