问题
Working with Node, moment.js and PostgreSQL 9.6
It's 2020-01-24 00:00:00+00:00 and Client A (the writer) is at offset -06:00 and casually
INSERTs a record with adatefield in it, with value 2020-01-23, and thinks Well, this record will hold everything I need to store for date 2020-1-23 (their 2020-01-23)Now it's 2020-01-24 00:20:00+00:00 and Client B (the reader) is at offset +11:00 and wants to see the information (from the same db and table) regarding 2020-01-24, BUT THERE IS NONE!! Because the writer, to the best of their knowledge, hasn't lived in 2020-01-24 yet.
- Should there be information available for the reader's 2020-01-24?
- How could time zone conversion be handled when querying and comparing dates in PG?
- Should we even think about time zones when only
datefields are involved? - Should
datefield be populated in a different manner? - What is considered best practice in these scenarios?
Thanks
来源:https://stackoverflow.com/questions/60105450/inserting-and-reading-a-date-type-field-from-different-time-zones-should-time