Search code examples
node.jsmomentjsnetlify

Event times set with moment.js are 1:30h forward than local when deploying to Netlify


I have a node.js script that uses moment.js to create timetables. Locally (in Minsk) it works good, but when i deploy it to Netlify every event is 1:30 forward than local one.

How to fix it?


Solution

  • Best way to implement moment is to write an override.js file.

    const moment = require('moment-timezone');
    moment.tz.setDefault('UTC');
    

    and call it at the first line of the server.

    You can find any example below which is how Ghost CMS has implemented the moment.js