Skip to content

Commit

Permalink
database/patches: special case during epoch/time conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
haraldschilly committed Mar 31, 2022
1 parent b7949a5 commit a57cd96
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/packages/database/postgres-blobs.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,12 @@ exports.extend_PostgreSQL = (ext) -> class PostgreSQL extends ext
opts.cb(err)
else
for p in patches
p.time = new Date(p.epoch)
# TODO why using epoch and then converting to Date, why not just taking time?
# Besides that: @hsy noticed in development that p.epoch could be a string, resulting in an invalid date.
if typeof p.epoch == 'string'
p.time = new Date(parseInt(p.epoch))
else
p.time = new Date(p.epoch)
delete p.epoch
opts.cb(undefined, patches)

Expand Down

0 comments on commit a57cd96

Please sign in to comment.