ntz
Normalizes timezone inside a date string to make it convertible to a JavaScript Date.
Last updated 2 years ago by thlorenz .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install ntz 
SYNC missed versions from official npm registry.

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

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

Current Tags

  • 0.1.2                                ...           latest (2 years ago)

3 Versions

  • 0.1.2                                ...           2 years ago
  • 0.1.1                                ...           2 years ago
  • 0.1.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (1)
Dependents (2)

Copyright 2014 - 2017 © taobao.org |