Skip to content

Commit 1da5f75

Browse files
leshakosskossnocorp
authored andcommitted
Add an isDate test for Invalid Date
1 parent b97beb8 commit 1da5f75

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/isDate/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,17 @@
1717
* //=> true
1818
*
1919
* @example
20-
* // For a value
20+
* // For an invalid date:
21+
* var result = isDate(new Date(NaN))
22+
* //=> true
23+
*
24+
* @example
25+
* // For some value:
2126
* var result = isDate('2014-02-31')
2227
* //=> false
2328
*
2429
* @example
25-
* // For a object
30+
* // For an object:
2631
* var result = isDate({})
2732
* //=> false
2833
*/

src/isDate/test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ describe('isDate', function () {
1010
assert(isDate(new Date()))
1111
})
1212

13+
it('returns true if the given value is an Invalid Date', function () {
14+
assert(isDate(new Date(NaN)))
15+
})
16+
1317
context('with date passed from another iframe', function () {
1418
afterEach(function () {
1519
const iframe = document.getElementById('iframe')

0 commit comments

Comments
 (0)