Magic Trick. Postgresql, nodejs and dates

Pay attention to this magic trick.

Date stored in PG as timestampz. Everything is UTC.

Does anyone have a plausible explanation to this kind of witchcraft?

Maybe @patrick can check what goes wrong there.

1 Like

Goblins in my computer.

1 Like

@patrick if I add a date formatter it works correctly. The query data doesn’t get overwritten.

I don’t know if this will help you pinpoint the issue but I will use it as a workaround for now. Nonetheless this issue seems pretty important as time data issues can lead to all sorts of unwanted behaviour.

image

image

If I remove the formatter the query1 data is overwritten by End value and as such the Startis also overwritten.

image

image

Data from the DB that is being pulled by query1.

image

I have to check the date formatters, seeing your video it looks like it is updating the date by reference, this is something that should not happen.

1 Like

Yep. It seems to be the case.

I had a look at the formatters and didn’t see anything weird to be honest but I didn’t follow the money after the return and didn’t check either parseDate()

Also I checked if by adding the toUTCTime() the date was being cloned or something but I didn’t see anything of that going on in the formatter.