From 0e90955aa578f45b2d59849c51ab045b546f9655 Mon Sep 17 00:00:00 2001 From: rex Date: Wed, 29 May 2019 14:40:55 +0800 Subject: [PATCH] =?UTF-8?q?[bugfix]=20DatetimePicker:=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?wepy=E4=B8=AD=E7=BB=84=E4=BB=B6=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/datetime-picker/index.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/datetime-picker/index.ts b/packages/datetime-picker/index.ts index ae2592a3..fa76a79b 100644 --- a/packages/datetime-picker/index.ts +++ b/packages/datetime-picker/index.ts @@ -18,7 +18,7 @@ function padZero(val: string | number): string { function times(n: number, iteratee: (index: number) => string): string[] { let index = -1; - const result = Array(n); + const result = Array(n < 0 ? 0 : n); while (++index < n) { result[index] = iteratee(index); @@ -135,7 +135,7 @@ VantComponent({ return this.set({ columns: results }); }, - getRanges(): object[] { + getRanges() { const { data } = this; if (data.type === 'time') { return [ @@ -220,7 +220,7 @@ VantComponent({ return value; }, - getBoundary(type: string, innerValue: number): object { + getBoundary(type: string, innerValue: number) { const value = new Date(innerValue); const boundary = new Date(this.data[`${type}Date`]); const year = boundary.getFullYear(); @@ -262,11 +262,11 @@ VantComponent({ this.$emit('cancel'); }, - onConfirm(): void { + onConfirm() { this.$emit('confirm', this.data.innerValue); }, - onChange(): void { + onChange() { const { data } = this; let value;