Node date locale strings changed format

Sometime in the last couple of days the Functions environment locale seems to have changed. Using Node’s Date.toLocaleString() used to return an ISO date:

2020-1-6 00:32:39

That’s the string I got the last time I called my function. Today it’s using the en locale, or equivalent:

1/8/2020, 3:28:13 PM

I made no changes to my function in the meantime. I tried specifying the ISO format: Date.toLocaleString('ISO') but it makes no difference, returning the same month-first string. These dates get fed into my Jekyll site, which goes ahead and wrongly interprets them as D/M/YYYY. I noticed this because today I posted something and it ended up dated August 1st 2020.

Is this an intended change or a bug? How can I get ISO dates back? Thanks!

I suspect this was due to the migration from node v8 to node v12 under the covers:

Could that explain the change? I don’t know for sure, but the timeline lines up pretty well…

1 Like

Yeah, that must be it! I’ve already implemented a fix for date handling in my function, but I’ll investigate upstream. Thanks for clearing up the mystery.

1 Like