is-datestring
Check if a string is a datetime string
💥 Be aware of some quirks. Use at your own risk. Pull requests welcome if you would like to help close issues on this module.
Install
$ npm install --save is-datestring
Usage
var isDateString = ; ;// => true ;// => true ;// => true ;// => true ;// => false ;// => false
Supported Formats
Currently, this module considers the following formats to be datestrings:
2015-03-25
2015-03-25
1/1/2015
Mar 25 2015
25 Mar 2015
Wednesday March 25 2015
Wed Sep 09 2015 23:11:46 GMT+0100 (WEST)
2016-12-30T08:00:00.000Z
Other formats are likely to be supported, but this module only tests for the formats listed above. Pull requests are welcome if you would like to add test coverage for additional formats.
Known Issues
- Allows Strange Values: This module uses JavaScript
Date()
constructor to help determine if a string is a valid datestring. Because of this, the module is suceptible to certain JavaScript quirks, and sometimes it lets some unassuming dateString values pass as valid datestrings. See Issue #2 for more information.
License
MIT @ Michael Wuergler