Added new APIs - tz.countries(), tz.country(), tz.zonesOfCountry to consume meta data about timezones. #175
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Its a large commit, with plenty of additions so please bare with me! :)
Summary
The goal here is to add a new set of APIs to the toolkit of moment-timezone to consume meta-data about countries. following is the list of new APIs:
moment.tz.countries()
: Returns a list(array) ofCountry
objects.Each
Country
object has:moment.tz.country(countryCode)
: Returns the country object for the given ISO 3166 alpha-2 country codemoment.tz.zonesOfCountry(countryCode)
: Returns a list(array) of zone objects used in the country. For this API, a few additional properties are added to theZone
objects:Tests: New test cases for these additional APIs/utils have been added in following locations:
tests/moment-timezone/countries.js
: Tests the three APIs mentioned above.tests/moment-timezone/pack-country.js
: Tests the utils which packs the country data.tests/moment-timezone/unpack-country.js
: Tests the utils which unpacks the country data.Docs: The docs have been updated to reflect the change in the order in which the grunt tasks are run, namely, have moved
data-meta
task to happen beforedata-pack
.@timrwood Its a huge commit, lots of changes, so please take your time in reviewing it! The core tests have all passed, so it looks fine from that point of view, but would definitely like an additional pair of eyes to run through this patch.
Thanks.