owid / owid-grapher

A platform for creating interactive data visualizations
https://ourworldindata.org
MIT License
1.36k stars 230 forks source link

`gdocs_posts.updatedAt` is often set to the unix epoch #3832

Open larsyencken opened 1 month ago

larsyencken commented 1 month ago

Context

We use a timestamp model for gdocs_posts which includes a few fields, such as:

By design, we expect updatedAt to be NULL if no updates have happened post create. This is how it is defined in MySQL.

Problem

A number of rows in gdocs_posts (e.g. with slug = 'fiona-spooner') have the Unix epoch (1970-01-01) set instead of NULL.

Impact

It only seems to have been a problem for:

Technical notes

After checking the schema, this must be happening on the JS side rather than the MySQL side. We can fix the rows, but it would be nice to fix the JS model to avoid this scenario.

marcelgerber commented 1 month ago

It's probably this line here?: https://github.com/owid/owid-grapher/blob/2b79d4baf8ebb3a01f5e0b83f05f1cdcc4317c8f/db/model/Gdoc/GdocFactory.ts#L66

I quickly checked, and new Date(null) is indeed 1970-01-01.