Luxon Creates Dates in Future Instead of In past for Safari 14 Browser Only

Good morning, StackOverflowians!

I apologize if this has been answered before, but I couldn’t find anyone with precisely the same problem, nor have I found a solution from researching…

Here’s the story:

I have an AsOf date, in DateTime coming into my react app from the server. This date gets converted to camel-cased JSON via camelcaseKeys. This date is then displayed in the app using the line

{DateTime.fromISO(obj.asOf).toRelative()}

…where obj is the object with the asOf property, assumed to be non-null and correctly formatted for our case. DateTime, fromISO and toRelative are all from luxon.

This code works perfectly well on every browser we need (Chrome, IE11, Firefox, etc.) It also works correctly with Safari 13, Mac OS 10.15 in testing.

However, on Safari 14 and Mac OS 11, it consistently results in a display date in the future. Instead of “One Minute Ago”, the output of that code becomes “In One Minute”. During some later tests, it became consistently “in 27 seconds.”

As stated above, I haven’t found a solution for this, nor anyone else that had the same problem. If you have any thoughts, advice, or have ever encountered this before, please chime in =). Your heroism would be much appreciated!

Answer

The solution had nothing to do with either React or Luxon, unfortunately. The testing machine we were using had a broken clock, which caused odd results when relative time was calculated. Please see the comment on the question for explanation.