ntz

0.1.2 • Public • Published

ntz build status

become a patron

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

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

Readme

Keywords

none

Package Sidebar

Install

npm i ntz

Weekly Downloads

10

Version

0.1.2

License

MIT

Unpacked Size

10.8 kB

Total Files

8

Last publish

Collaborators

  • thlorenz