Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle missing time zone data better #106

Closed
mattjohnsonpint opened this issue Jul 14, 2014 · 4 comments
Closed

Handle missing time zone data better #106

mattjohnsonpint opened this issue Jul 14, 2014 · 4 comments

Comments

@mattjohnsonpint
Copy link
Contributor

Currently, if you forget to load the time zone data, or you typo or make up a zone that doesn't exist, you get the local time.

moment().tz("Foo/Bar").format()

Instead, this should error with something like:

The zone "Foo/Bar" could not be found. Did you forget to load the time zone data file?

Or something like that.

This will improve the dev experience, as several questions get posted on StackOverflow where the only issue is that they didn't see or understand the instructions for loading the tz data.

@timrwood
Copy link
Member

Yeah, I think a console.error would be good here.

I'm considering removing the link to just the library on the download section and having the output from the data builder include both the library and the data. This way, you would always have some data loaded.

@timrwood
Copy link
Member

Check out the console here. http://jsfiddle.net/timrwood/nwY6m/

The nice thing about console.error is that you can get a stack trace of where the error is coming from.

@mattjohnsonpint
Copy link
Contributor Author

I like. Thank you!

@timrwood
Copy link
Member

This is published as of moment-timezone@0.2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants