Date Formatting Issues During Build using Gulp

On our site InDebted’s blog page, I’ve attempted to format our blog post dates (pulled from Contentful) as follows:

const date = Intl.DateTimeFormat('en-AU', { dateStyle: 'medium' }).format(new Date(article.fields.publishDate)

On local testing, and on our staging server (https://stage-www.indebted.co) these are formatted correctly as follows:

Feb 14, 2021

However on our production site, formatting doesn’t work and looks like this:

2/14/2021

I’m really not sure how this happening, especially now that our staging and master branches are even. Is there some configuration option I’m missing?

The code snippet does look correct, so I’m not sure why it’s not working. Maybe have a look here: https://techoverflow.net/2018/09/19/fixing-nodejs-intl-datetimeformat-not-formatting-properly-for-locales/?

I’ve tried this solution and it didn’t work, however I have realised that this isn’t working on production Node version (v10.23.3), but is working on my local Node version (12.20.1) and staging (12.18.0).

Should I change the Node version of my production server?

Sure. That might work.

Yeah I added the working version to .nvmrc and it worked! Cheers.

1 Like