Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
spacetime-informal
Advanced tools
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.
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:
(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
0.2.0
FAQs
interpret abbreviated and informal timezone names
The npm package spacetime-informal receives a total of 1,580 weekly downloads. As such, spacetime-informal popularity was classified as popular.
We found that spacetime-informal demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.