πΎ Archived View for gmi.bacardi55.io βΊ blog βΊ 2017 βΊ 03 βΊ 19 βΊ kalliope-what-time-is-it-in captured on 2023-07-22 at 16:46:10. Gemini links have been rewritten to link to archived content
β¬ οΈ Previous capture (2023-01-29)
-=-=-=-=-=-=-
Posted on 2017-03-19
When you work with multiple country and different timezone, you're always wondering what time it is there⦠And I was fed up to keep opening a tab in a browser to find out again and again.
So I decided to create a kalliopΓ© neuron to be able to ask kalliopΓ©[1] what time it is in any city / country :) and I create the [wwtime neuron]https://github.com/bacardi55/kalliope-wwtime([2]) to do so!
1: https://kalliope-project.github.io/
2: https://github.com/bacardi55/kalliope-wwtime(
This neuron will retrieve a local timezone and a requested city timezone. It compares timezone difference (including summer time) between the two location to give you the time there based on your timezone.
Eg:
When it's 10pm in Paris, Kalliope will tell me it is 5pm in Boston (because as of now, boston is in summer time and paris not yet, so -5 and not -6)
It uses GoogleMaps API to get geolocation data based on a city name or address. So you need to activate to Google API:
To make it works, you will need to get an API key on your developer console[5]. Or follow documentation here[6] and here[7]
3: https://developers.google.com/maps/documentation/timezone/intro
4: https://developers.google.com/maps/documentation/geocoding/intro
5: https://console.developers.google.com/apis/dashboard
6: https://developers.google.com/maps/documentation/geocoding/get-api-key
7: https://developers.google.com/maps/documentation/timezone/get-api-key
kalliope install --git-url https://github.com/bacardi55/kalliope-wwtimes.git
βββββββββββββββββ¬βββββββββββ¬ββββββββββ¬ββββββββββ¬ββββββββββββββββββββββββββββββββ β parameter β required β default β choices β comment β βββββββββββββββββͺβββββββββββͺββββββββββͺββββββββββͺββββββββββββββββββββββββββββββββ‘ β gmaps_api_key β yes β β string β The api key to use googlemaps β β β β β β API. See above. β βββββββββββββββββΌβββββββββββΌββββββββββΌββββββββββΌββββββββββββββββββββββββββββββββ€ β local β yes β β string β Your city/address to compare β β β β β β time difference with β βββββββββββββββββΌβββββββββββΌββββββββββΌββββββββββΌββββββββββββββββββββββββββββββββ€ β city β yes β β string β What city/address where you β β β β β β want to know time β βββββββββββββββββ΄βββββββββββ΄ββββββββββ΄ββββββββββ΄ββββββββββββββββββββββββββββββββ
ββββββββββ¬ββββββββββββββββββββββ¬βββββββββ¬βββββββββββββββββββββββββββββββββββββββ β Name β Description β Type β sample β ββββββββββͺββββββββββββββββββββββͺβββββββββͺβββββββββββββββββββββββββββββββββββββββ‘ β status β Response status β String β OK or KO β ββββββββββΌββββββββββββββββββββββΌβββββββββΌβββββββββββββββββββββββββββββββββββββββ€ β β β β [arg: 'new york city', 'timezoneid': β β city β A dictΒΉ (see below) β dict β 'America/New_York', 'timezonename': β β β β β 'Eastern Daylight Time', time: β β β β β {'hour': '10', 'minute': '30'}] β ββββββββββΌββββββββββββββββββββββΌβββββββββΌβββββββββββββββββββββββββββββββββββββββ€ β β β β [arg: 'Paris France', 'timezoneid': β β β β β 'Europe/Paris', 'timezonename': β β local β A dictΒΉ (see below) β dict β 'Central European Standard Time', β β β β β time: {'hour': '10', 'minute': β β β β β '30'}] β ββββββββββ΄ββββββββββββββββββββββ΄βββββββββ΄βββββββββββββββββββββββββββββββββββββββ
ΒΉ: these dict contains:
Get a city by argument in order
- name: "Wwtime-city" signals: - order: "what time is it in {{city}}" neurons: - wwtime: gmaps_api_key: "{{gmaps_api_key}}" local: "Paris France" args: - city file_template: "templates/fr_wwtime.j2"
Get a city by argument set in brain:
- name: "Wwtime-city-boton" signals: - order: "heure boston" neurons: - wwtime: gmaps_api_key: "{{gmaps_api_key}}" city: "boston MA" local: "Paris France" file_template: "templates/fr_wwtime.j2"
{% raw %} {% if status == "OK" %} Sir, in {{city.arg}}, it is {{city.time.hour}} hour and {{city.time.minute}} minutes, whereas here, it's {{local.time.hour}} hour and {{local.time.minute}} minutes Le timezone est {{city.timezonename}} {% else %} Sorry sir, but I don't know {% endif %} {% endraw %}