https://github.com/qingwei-li/parsedate
Converts a value to a Date
https://github.com/qingwei-li/parsedate
date parse parser string
Last synced: about 1 year ago
JSON representation
Converts a value to a Date
- Host: GitHub
- URL: https://github.com/qingwei-li/parsedate
- Owner: QingWei-Li
- License: mit
- Created: 2017-07-29T03:08:53.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-07-29T03:14:38.000Z (almost 9 years ago)
- Last Synced: 2024-10-30T02:47:34.479Z (over 1 year ago)
- Topics: date, parse, parser, string
- Language: JavaScript
- Size: 20.5 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# parsedate
[](https://travis-ci.org/QingWei-Li/parsedate)
[](https://www.npmjs.com/package/parsedate)
> Converts a value to a Date
## Install
```sh
npm i parsedate
# yarn add parsedate
```
## Usage
```js
var parseDate = require('parsedate')
// Parse string
parseDate('738720000000')
// => new Date('1993-05-30T00:00:00.000Z')
parseDate('1995-05-30')
// => new Date('1995-05-30T00:00:00.000Z')
// Parse number
parseDate(738720000000)
// => new Date('1993-05-30T00:00:00.000Z')
// Parse Date
parseDate(new Date())
// => new Date()
// Parse other
parseDate('🌚')
// => null
parseDate('')
// => null
```
## License
MIT