When I receive various times in UTC from a REST application, I encounter different results.
Examples include 2999-01-30T23:00:00.000Z
and 1699-12-30T23:00:00.000Z
.
To display these times on the front end, I use new Date(date)
in JavaScript to convert them to Time.
The issue arises with the resulting format of the converted time.
new Date("2999-01-30T23:00:00.000Z")
shows as Thu Jan 31 2999 00:00:00 GMT+0100
, which is expected behavior.
However,
new Date("1699-12-30T23:00:00.000Z")
displays as Wed Dec 30 1699 23:57:44 GMT+0057
.
Why does this unexpected output occur? What causes this peculiar time shift?
I am curious about finding the root of the problem or if there is any solution available. Unfortunately, my search has been unsuccessful so far.