moment-timezone
moment-timezone copied to clipboard
utcOffset function is not working at CentOS 7
I tested as below at Ubuntu 16 and CentOS 7.3 to get utc offset.
const moment = require('moment-timezone'); const timezoneName = moment.tz.guess(); const timezone = moment.tz.zone(timezoneName); const now = Date.now(); console.log(timezone.utcOffset(now));
It worked well at Ubuntu. But timezone.utcOffset(now) returned error at CentOS as below.
TypeError: timezone.utcOffset is not a function
at Object.
And timezone.offset(now) worked well without any deprecation message.
Doesn't seem to work for me on Mac OS either.
I literally copied and pasted this from the moment-timezone website
moment.tz.zone('America/Los_Angeles').utcOffset(1403465838805)
But the error is that the function utcOffset does not exist.
Got this example from another ticket: moment.tz('2026-07-27', 'Europe/Zurich').utcOffset() which does seem to work fine. The online example is just out of date I guess
I'm closing off stale issues as they're very difficult to reproduce, and this project is now in maintenance-only mode. Try upgrading to the latest version of Moment Timezone, but feel free to open a new issue if this is still a problem.