I have seen a variety of threads that are adjacent to this topic. However, my google fu has failed me so far.
I have a value on my server that is a date represented as a string. I am certain it is the milliseconds since the UTC epoch.
I will write it like this for stackOverflow:
const k = '1638400203941'
Date.parse(k); // NaN
const a = parseInt(k, 10);
Date.parse(a); // NaN
// ah ha! but what about...
Date.parse(Date.now() - a); // nope, NaN
I am sure this has been done a thousand times before but how do I do this?
To clarify, the goal is to parse my server's output, k = 1638400203941
into a date. YYYY-MM-DD or MM-DD-YYYY is ok.
edit: Somehow I didn't think to try the given solution. It was giving me Invalid date
for some reason, guessing that I was passing in the string version instead of int. My mistake guys.