0.2.3 • Public • Published

Local time and weather command line tool

Command-line tool to look up the local time (and weather) for time zones, countries and cities with auto-completion.

Animated GIF of localtime shell CLI, showing the city of London being typed in and picked from a list, then local time and weather results appear.

My partner (❤️ 🐸) was out of town, and I wanted a quick way to see her local time and weather. Fun little project to start using TypeScript too.


Install as a global localtime command:

npm install -g localtime-cli

Or run ad hoc:

npx localtime-cli


Show full options with localtime --help

  • -t --timezone use timezone names for search (default: true)
  • --no-timezone don't use timezone names
  • -c --country use country names
  • -y --city use city names with a population >= 250,000
  • -Y --city-all use all city names
  • -a --all-min, use all location types (with minimum city population)
  • -A --all use all location types (no city population minimum)
  • -w --weather include local weather
  • -o --openweather-api-key <key> specify OpenWeather API key
  • -o --save-openweather-api-key <key> specify and save OpenWeather API key for future use
  • -l --last bypass location search and reuse last location used
  • -C --metric, use metric units (celsius)
  • -F --imperial, use imperial units (fahrenheit)

Thus localtime -c -y would search time zone, country and larger city names and localtime --no-timezone -Y would search just through all city names, since time zones are always used unless explicitly excluded.

Multiple single letter options can be combined too: localtime -cy.

The last previously used location will be sorted to the top of the list unless --skip-last-used-sort is used.


Weather info works for city selections and requires a free OpenWeather API key provided via the -o option to use it once or -O to save it for future use without needing to provide it as an option again.


localtime -y -w -O abc123

In subsequent uses, you can then just run localtime -y -w.

You can also set it via the OPENWEATHER_API_KEY environment variable.

Initially, the metric system will be used and weather temperatures will be in celsius. Subsequent invocations will reuse the previously specified unit of measurement, unless a new one is selected via command line options.

- Joost Schuur (@joostschuur)

Package Sidebar


npm i localtime-cli

Weekly Downloads






Unpacked Size

465 kB

Total Files


Last publish


  • jschuur