npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

tzloc

v1.5.2

Published

find the time in a place

Downloads

21

Readme

tzloc

find the time in a place

command example

$ tzloc 3pm in tashkent to santiago time
2015-04-15 06:00:00
$ tzloc 9:30 in oakland to nuuk time -v
2015-04-15 14:30:00 Oakland CA US   Nuuk 07 GL
$ tzloc 5:45pm nov 22 in yellowknife to melbourne time
2015-11-23 09:45:00
$ tzloc tz lensk
Asia/Yakutsk
$ tzloc offset lensk 
540
$ tzloc now in miami
2015-04-22 22:02:24

api example

var tzloc = require('tzloc');
var strftime = require('strftime');

tzloc('3pm', 'tashkent', 'santiago', function (err, rows) {
    if (err) console.error(err);
    else console.log(strftime('%F %T', rows[0].date));
});

usage

tzloc TIME SRC DST
tzloc TIME in SRC to DST (time)
tzloc -t TIME -s SRC -d DST

  Compute and print the time at DST when the time at SRC is TIME.
  
    -v --verbose  Show found source and destination.
  
  tzloc '5pm aug 20' 'beijing' 'seattle'
  tzloc 11am in wellington to nyc time

tzloc in PLACE
tzloc now in PLACE
tzloc now to PLACE (time)

  Print the time in PLACE.

    -v --verbose  Show found source and destination.

tzloc tz PLACE

  Print the IANA time zone for PLACE.

tzloc offset PLACE
tzloc offset TZNAME

  Print the timezone offset in minutes for TZNAME or the PLACE.

tzloc help

  Show this message.

OPTIONS for all commands with multiple rows of output:

  -a --all      Show all records, not just the first.
  -n COUNT      Show COUNT records.     

methods

var tzloc = require('tzloc')

tzloc(timestr, src, dst, cb)

Calculate the time in dst when the time in src is timestr.

All matches for the placename strings src and dst are provided as pairs in cb(err, rows).

Each row has src, dst, and date properties. The src and dst values are given by placename and augmented with the computed timezone. Each row looks like this:

{ src: 
   { name: 'Tashkent',
     country: 'UZ',
     altCountry: '',
     muni: '',
     muniSub: '',
     featureClass: 'P',
     featureCode: 'PPLC',
     adminCode: '13',
     population: 1978028,
     lat: 41.26465,
     lon: 69.21627,
     from: 'tashkenti',
     tz: 'Asia/Almaty' },
  dst: 
   { name: 'Santiago',
     country: 'CL',
     altCountry: '',
     muni: '13101',
     muniSub: '',
     featureClass: 'P',
     featureCode: 'PPLC',
     adminCode: '12',
     population: 4837295,
     lat: -33.45694,
     lon: -70.64827,
     from: 'santiago',
     tz: 'America/Santiago' },
  date: Wed Apr 15 2015 06:00:00 GMT-0700 (PDT) }

install

With npm, to get the command do:

npm install -g tzloc

and to get the library do:

npm install tzloc

license

MIT