toDate.js 493 B

12345678910111213141516171819
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = toDate;
  6. var _assertString = _interopRequireDefault(require("./util/assertString"));
  7. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8. function toDate(date) {
  9. (0, _assertString.default)(date);
  10. date = Date.parse(date);
  11. return !isNaN(date) ? new Date(date) : null;
  12. }
  13. module.exports = exports.default;
  14. module.exports.default = exports.default;