Open TimurIskandarov opened 1 year ago
thanks bro
вт, 25 окт. 2022 г. в 18:51, Timur @.***>:
There is an entity
type Proposal struct { ID int Date time.Time }
There is an entity table DDl
CREATE TABLE public.proposal ( id serial NOT NULL, date timestamp NULL, CONSTRAINT pk_proposal PRIMARY KEY (id), );
- Insert works correctly (i.e. 2022-10-26T00:00:00.000Z)
// create entity location, := time.LoadLocation("Europe/Moscow") date, := time.Parse(time.RFC3339, "2022-10-25T21:00:00.000Z") p := &Proposal{ Date: date.In(location) } // insert entity err := r.conn.QueryRow( "INSERT INTO proposal (date) VALUES ($1) RETURNING id", p.Date, ).Scan(p.ID)
- Fetch works incorrectly (i.e. 2022-10-26 00:00:00:00 +0000 +0000, not 2022-10-26 00:00:00:00 +0300 MSK)
proposal := new(Proposal) err := r.conn.QueryRow( "SELECT date FROM proposal ORDER BY id DESC LIMIT 1", ).Scan(&p.Date)
In the future, an incorrect date is obtained on the frontend new Date(date).toLocaleString('ru-RU'), that is, 26.10.2022, 03:00:00.
— Reply to this email directly, view it on GitHub https://github.com/lib/pq/issues/1093, or unsubscribe https://github.com/notifications/unsubscribe-auth/AY6WB6XEGGRQJF66SKLXP6TWE7QXVANCNFSM6AAAAAARN74JSU . You are receiving this because you are subscribed to this thread.Message ID: @.***>
There is an entity
There is an entity table
DDl
2022-10-26T00:00:00.000Z
)2022-10-26 00:00:00:00 +0000 +0000
, not2022-10-26 00:00:00:00 +0300 MSK
)In the future, an incorrect date is obtained on the frontend
new Date(date).toLocaleString('ru-RU')
, that is,26.10.2022, 03:00:00
.