kevinroberts / city-timezones Goto Github PK
View Code? Open in Web Editor NEWA light and fast method of looking up timezones given the name of city.
A light and fast method of looking up timezones given the name of city.
Hi!
Thanks for this. So far it is the best data for my purpose β¦ a simple LaunchBar action.
It is not a huge blow, but there are a couple of entries without a timezone. Just wanted to let you know.
β Christian
ny, usa
new york, us
NY, us
new york, united states of america
Hi,
Thank you for the efforts in developing this module.
I have found that most of the cities are not available in the json file.
I have attached a file which contains a list of missing cities in the json file, can you please look into it?
city.txt
Suggestion: compress your JSON data for loading using zipson.
You'd want to keep the original data file to maintain your data, but publish a compressed version thatβs use to load the JSON into memory.
tried updating to 1.2.2 and getting this now:
see my PR: calcom/cal.com#15927
Originally posted by @PeerRich in #26 (comment)
I tried to use this one, but, some cities has no data.
Would it be possible to add support for flattened city names, where the accents are removed, so we can look up cities irrespective of their accents?
Right now I have a workaround:
When I load:
for (let i = 0; i < cityTimezones.cityMapping.length; i++) {
// eslint-disable-next-line camelcase
(cityTimezones.cityMapping[i] as any).city_flattened
= removeAccents(cityTimezones.cityMapping[i].city_ascii).toLowerCase();
}
and then when I lookup:
cityName = removeAccents(cityName).toLowerCase();
cities = CityTimezones.cityMapping;
for (let i = 0; i < cities.length; i++) {
if ((cities[i] as any).city_flattened === cityName) {
return cities[i];
}
}
and the implementation for the removeAccents
function:
function removeAccents (text: string): string {
return text.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
}
The lookUpViaCity method returns America/Toronto
as timezone for London
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.