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) {
|
if (this.zooming && touches.length === 2) {
|
||||||
const distance = getDistance(touches);
|
const distance = getDistance(touches);
|
||||||
const scale = (this.startScale * distance) / this.startDistance;
|
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';
|
import { isNaN } from './number';
|
||||||
|
|
||||||
export function isDate(date: Date): boolean {
|
export function isDate(val: Date): val is Date {
|
||||||
return (
|
return (
|
||||||
Object.prototype.toString.call(date) === '[object Date]' &&
|
Object.prototype.toString.call(val) === '[object Date]' &&
|
||||||
!isNaN(date.getTime())
|
!isNaN(val.getTime())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user