Yaayyyy
Man, date and timezones are one of the most messy things to work with . To summarize:
- We had to add Greek to our available locations of the
moment.js
: https://github.com/tainacan/tainacan/blob/e305d97451dfb5ca2022e515f0163d3b4d781f18/webpack.common.js#L98. As I mentioned before, this is needed because we don’t bundle every location information with the plugin, they can be a heavy asset and so far we don’t have users all around the World. But that wasn’t the cause of the issue, it would just fallback to English in your case. - The dates are always saved on the database in a
ISO_8601
, that isYYYY-MM-DD
. We only change it while displaying (for that, metadata have aview_as_html
attribute that in this case uses WordPress format settings, you can see it here). - BUT we also have to change it in the metadatum input, and that’s where the issue happened. The input was decreasing a day because it was creating a Data object during the conversion that used the date values provided, such as
20/10/2020
. When creating such object, the instance was not handling well the timezone, because its value would be decreased three hours (as your timezone offset is positive, the very beginning of your day is a day already past in the Greenwich -20/10/2020T00:00:00
-03:00:00
=19/10/2020T21:00:00
). We never noticed that because here in Brazil three hours added won’t change our day . Luckily, after some investigation with @vnmedeiros we found that the functiontoISOString()
that we use to generate the data string has a parameterkeepOffset
, which avoids adjusting the hours to Greenwich. Soooo it was as simple as passingtrue
to this function when we needed it: https://github.com/tainacan/tainacan/blob/e305d97451dfb5ca2022e515f0163d3b4d781f18/src/views/admin/components/metadata-types/date/Date.vue#L66
That was fun, hope to have solved it for real. In any case, I believe we have a release ready for next week or the one after it. Thanks for the report, that’s the kind of thing that we would never find out!