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

spacetime-informal

v0.6.1

Published

interpret abbreviated and informal timezone names

Downloads

9,443

Readme

The IANA timezone database is the official nomenclature for timezone information, and is what you should use, whenever possible.

Humans though, are goofballs, and use a whole different informal scheme.


  • In (North) America, we use: PST, MST, EST...
  • in Europe (lately) they use: WEST, CEST, EEST...
  • in Africa they use: EAT, CAT, WAST...
  • in Australia they use: AWST, AEDT, ACST...

these line-up with the IANA timezones sometimes. Other times they don't.

These names collide all the time, (like IST - irish/indian stardard time).

These names produce all-sorts of ambiguities, regarding DST-changes - Both Winnipeg and Mexico City are CST, but have a much different DST schedule: image

(thanks timeanddate.com!)

Of course, there's a bunch of political/historical/disputed stuff going on, too. Apologies if I step into this unknowingly.

This library is an attempt to 'soften' this exchange, between human-IANA, using some opinionated-but-common-sense rules and decision-making.

It was built for use in the spacetime timezone library, but may be used without it.

const informal = require('spacetime-informal')

informal.find('EST')
// 'America/New_York'

informal.find('central')
// 'America/Chicago'

informal.find('venezuela')
// 'America/Caracas'

informal.find('south east asia')
// 'Asia/Bangkok'

informal.display('Toronto')
/*{
  standard: { name: 'Eastern Standard Time', abbrev: 'EST' },
  daylight: { name: 'Eastern Daylight Time', abbrev: 'EDT' },
  iana: 'Canada/Toronto'
}*/

it was built to be as forgiving as possible, and return the most common-sense IANA timezone id from user-input.


along with spacetime, you can generate human-friendly time formats, like this:

const spacetime = require('spacetime')
const informal = require('spacetime-informal')

let display = informal.display('montreal')
let s = spacetime.now(display.iana)
let abbrev = s.isDST() ? display.daylight.abbrev : display.standard.abbrev // (add some null-checks)
let time = `${s.time()} ${abbrev}`
// '4:20pm EDT'

work-in-progress.

MIT