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

Add timezone converter #16

Open
Moobiful opened this issue May 4, 2017 · 4 comments
Open

Add timezone converter #16

Moobiful opened this issue May 4, 2017 · 4 comments

Comments

@Moobiful
Copy link

Moobiful commented May 4, 2017

~time [city] Displays UTC timezone for , followed by the current time in military format

User: "~time Paris"

Hourai: "[UTC+1:00] Paris, France (5:00)"

~time [country] Displays all UTC timezones relative to large cities in the specified country's timezones

User: "~time USA"

Hourai:
"[UTC-10:00] Honolulu, Hawaii (17:46)"
"[UTC-9:00] Anchorage, Alaska (18:46)"
"[UTC-7:00] Los Angeles, California (20:46)"
"[UTC-5:00] Chicago, Illinois (10:46)"
"[UTC-4:00] New York City, New York (00:46)"

~time [continent] Displays all UTC timezone in the continent followed by the largest city in each timezone, followed by the current time in military format.

User: "~time Europe"

Hourai:
"[UTC+0:00] London, England (4:46)"
"[UTC+1:00] Paris, France (5:46)"
"[UTC+2:00] Warsaw, Poland (6:46)"
"[UTC+3:00] Moscow, Russia (7:46)"

@james7132
Copy link
Owner

This can be a particular issue since the popular APIs I was considering using like Google Map's Time Zone API allows easy fetching, but is only 2,500 requests per day free. Either I'll need to very strictly rate limit this, or be willing to fork up a bit cash, even with caching.

https://developers.google.com/maps/documentation/timezone/usage-limits

@Moobiful
Copy link
Author

Moobiful commented May 4, 2017

Why not just calculate the time locally? Time zones in continents don't change so the only requests that you'd ever need to make is for specific cities, rather than countries and continents which would only return the most populated cities' time zones.

If Hourai knows what time it is locally, she can do a conversion to the user specified time zones as long as the UTC+X:00 timezone for both areas is stored locally, after compensating for DST, which can be checked for with just one request every day. Then, all she'd have to do is get the local time and add or subtract for each field.

It'd only really become much of an issue if people make requests for specific cities that aren't ones like Paris, LA, or London, as the time zones for those large cities would be stored locally.

@james7132
Copy link
Owner

james7132 commented May 5, 2017

The problem is mapping a text location to a time zone is not so simple: i.e. how does Hourai know that "Atlanta" is in the same time zone as "40.730610, -73.935242"?

If operating purely on a time zone descriptor to time zone descriptor basis (for example: PST to EST), that might be easier, but also pretty poor UX.

@james5922
Copy link

james5922 commented Jun 4, 2017

What if Hourai was set to only accept locations in a valid "City, State/Province, Country" form?

Update: #26

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

No branches or pull requests

3 participants