isBefore.js 367 B

123456789
  1. import assertString from './util/assertString';
  2. import toDate from './toDate';
  3. export default function isBefore(str) {
  4. var date = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : String(new Date());
  5. assertString(str);
  6. var comparison = toDate(date);
  7. var original = toDate(str);
  8. return !!(original && comparison && original < comparison);
  9. }