11 lines
197 B
JavaScript
11 lines
197 B
JavaScript
|
'use strict'
|
||
|
module.exports = value => {
|
||
|
const date = new Date(value)
|
||
|
/* istanbul ignore if */
|
||
|
if (isNaN(date)) {
|
||
|
throw new TypeError('Invalid Datetime')
|
||
|
} else {
|
||
|
return date
|
||
|
}
|
||
|
}
|