joewang704 joewang704 - 4 months ago 25
Javascript Question

moment.js isoWeek does not work on Heroku instance

My app depends on

in order to determine the current start of the week. On my machine, this works fine and returns
Mon Oct 31 2016 00:00:00 GMT-0400 (EDT)
as expected. However, on my Heroku instance, this code breaks server side, returning
Sun Oct 30 2016 20:00:00 GMT-0400 (EDT)
. These outputs are gathered from just running
in an Express endpoint.

The code also works as expected on the client side on my deployed Heroku application, returning Monday when I log it, it only seems to give the wrong output on the server.


This is because the Heroku instance default timezone is UTC and your local machine will have your timezone.

Are you running this server-side (on node.js)? Or are you running this client-side? If you run it client-side it should detect your timezone.