Skip to content

Instantly share code, notes, and snippets.

@nitely
Created January 18, 2019 21:31
Show Gist options
  • Save nitely/697b70960db5cc5e5e3c56dd8bd5445c to your computer and use it in GitHub Desktop.
Save nitely/697b70960db5cc5e5e3c56dd8bd5445c to your computer and use it in GitHub Desktop.
moment.js timezone SyntaxError
/*
ERROR in ./node_modules/moment-timezone/data/packed/latest.json
Module parse failed: Unexpected token e in JSON at position 0 while parsing near 'export default {
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: /usr/src/app/ui/src/tz: Unexpected token, expected ";" (1:10)
Here is a solution:
*/
import 'moment-timezone/moment-timezone'
moment.tz.load({
"version": "2018g",
"zones": ["Etc/UTC|UTC|0|0|"],
"links": [
"Etc/UCT|UCT",
"Etc/UTC|Etc/Universal",
"Etc/UTC|Etc/Zulu",
"Etc/UTC|UTC",
"Etc/UTC|Universal",
"Etc/UTC|Zulu"
]
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment