mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
types(utils): improve isDate typing
This commit is contained in:
parent
1baa60f224
commit
e6bd26e0aa
@ -214,7 +214,8 @@ export default createComponent({
|
||||
if (this.zooming && touches.length === 2) {
|
||||
const distance = getDistance(touches);
|
||||
const scale = (this.startScale * distance) / this.startDistance;
|
||||
this.scale = range(scale, +this.minZoom, +this.maxZoom);
|
||||
|
||||
this.setScale(scale);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -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())
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user