Verifies if the given input is a valid representation of a date. It tries to create a date from:

  • numbers as timestamps, using new Date(timestamp)
  • YYYY-MM-DD format for date-only check
  • MM-DD-YYYY format for date-only check
  • YYYY-MM-DD HH:MM:SS or YYYY-MM-DD HH:MM format for date + time check
  • MM-DD-YYYY HH:MM:SS or MM-DD-YYYY HH:MM format for date + time check.

Additional date options will be added in the near future.

'use strict';
thorin.validate('DATE', '2016-12-03 10:00'); // =>Sat Dec 03 2016 10:00:00 GMT+0200 (GTB Standard Time)
thorin.validate('DATE', 1470209505271);   // Wed Aug 03 2016 10:31:45 GMT+0300 (GTB Summer Time)
Do you have a question or is something missing?

You can always create a new issue on GitHub or contact one of the core founders by chat.