mirror of
https://github.com/youzan/vant.git
synced 2026-03-06 02:06:58 +08:00
types(utils): improve isDate typing
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { isNaN } from './number';
|
||||
|
||||
export function isDate(date: Date): boolean {
|
||||
export function isDate(val: Date): val is Date {
|
||||
return (
|
||||
Object.prototype.toString.call(date) === '[object Date]' &&
|
||||
!isNaN(date.getTime())
|
||||
Object.prototype.toString.call(val) === '[object Date]' &&
|
||||
!isNaN(val.getTime())
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user