vapor / fluent-postgres-driver

🐘 PostgreSQL driver for Fluent.
MIT License
146 stars 53 forks source link

updatedAt is incorrect after save #146

Closed Igor-Palaguta closed 4 years ago

Igor-Palaguta commented 5 years ago

updatedAt Date is different after save and when we read it again.

Steps to reproduce

My local time is 08:19, I am in +2 hours time zone

user.name = newName
user.save(on: request).do { user in
    // Here updated at is changed and has proper value
    // 2019-06-26 06:19:41 +0000
    print(user.updatedAt)
}.flatMap { user in
    // But when we read it again
    try User.find(user.requireID(), on: request).unwrap(or: Abort(.notFound))
}.do { user in
    // updatedAt is incorrect. Minus 2 hours from my real time
    // 2019-06-26 04:19:41 +0000
    print(user.updatedAt)
}

Expected behavior

It should be the same after save and after reading again

Actual behavior

updatedAt is incorrectly adjusted

Environment

Package.resolved https://github.com/vapor/vapor.git => 3.3.0 https://github.com/vapor/postgresql.git => 1.4.1

Igor-Palaguta commented 5 years ago

This happens just for field with type: TIMESTAMP with time zone

tanner0101 commented 4 years ago

Fixed by https://github.com/vapor/postgres-kit/pull/117