ttacon / libphonenumber

golang port of Google's libphonenumber
MIT License
618 stars 105 forks source link

add GetTimeZonesForRegion #31

Closed fabriziomoscon closed 7 years ago

fabriziomoscon commented 8 years ago

First attempt...

Retrieve the timezone of a string phone number passed. It uses the same data used by googlei18n/libphonenumber

related to this discussion #30


This change is Reviewable

fabriziomoscon commented 7 years ago

does this PR need more work @ttacon ?

ttacon commented 7 years ago

Hey! Sorry, just a quick question about load time!

fabriziomoscon commented 7 years ago

hi, I have just copied it from this: https://github.com/ttacon/libphonenumber/blob/5cb77679a4c77d45f2496c9ed8e60b5eec03bb47/countrycodetoregionmap.go#L3 I was not quite sure what the comment meant. Maybe you could remember why did you add the comment in the first place.

fabriziomoscon commented 7 years ago

@ttacon the build time for this branch is not affected by the new file, so I remove the comment. Please let me know if there anything else to do before merging

ttacon commented 7 years ago

If you can add a comment to the semantic structure of the CountyCodeToTimeZones map, I'll merge this after!

fabriziomoscon commented 7 years ago

@ttacon I have added this comment:

// This structure maps telephone number digits to a particular timezone,
// because a timezones could represent many prefixes, there could be many
// entries for the same timezone.
// For example this is the case for America/New_York.

and squashed the 3 commits.

ttacon commented 7 years ago

Thanks for the contribution!