Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
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
FAQs
interpret abbreviated and informal timezone names
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
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.