ToIsoString?

Al Jachimiak
Today I Googled
Published in
1 min readJan 6, 2017

What I Googled

js date toisostring

What I Was Doing

I was writing some nodejs code that cached the result of an api call to re-use later. When it get pulled out of redis , the date of the stored item needed to be compared to the current time.

I knew I could use a < or a > to compare the dates, but I wanted to see the dates on the console while my tests were running so I could verify what I thought was happening. I just wanted to console.log(A_PRETTY_DATE) but all my tries at appending the method to the date failed.

Solution

I was just capitalizing the wrong parts of the method. The info box in google held the correct answer of date.toISOString().

--

--