0.1.2 • Published 7 years ago
ntz v0.1.2
ntz
Normalizes timezone inside a date string to make it convertible to a JavaScript Date.
const ntz = require('ntz')
const original = 'Sunday, July 24, 19:32:00 CEST 2016'
console.log(new Date(original)) // => Invalid Date
const normalized = ntz(original)
console.log(new Date(normalized))// => 2016-07-24T17:32:00.000Z
Installation
npm install ntz
API
ntz
Replaces timezone abbreviation like 'CDT' with the matching UTC offset If no known timezone is encountered in the string, the original string is returned.
Parameters
s
String original date/time string
Returns String with timezone abbreviation replaced
License
MIT