forked from ard/ruoyi-api

‘liusuyi’
2023-07-18 9f0d9e8358442d5d156a4e8aa1e8d6bd4960a6f9
1
2
3
4
5
6
7
8
9
10
/**
 * Checks to see if a value is not only a `Date` object,
 * but a *valid* `Date` object that can be converted to a
 * number. For example, `new Date('blah')` is indeed an
 * `instanceof Date`, however it cannot be converted to a
 * number.
 */
export function isValidDate(value: any): value is Date {
  return value instanceof Date && !isNaN(value as any);
}