From bd6625c819e2fc74f0e29dc66aea00af87c2e801 Mon Sep 17 00:00:00 2001 From: "Hye Yeon, Kim" Date: Wed, 24 Nov 2021 16:33:25 +0900 Subject: [PATCH] =?UTF-8?q?[#954][3.0]=20DatePicker=20>=20range=20?= =?UTF-8?q?=EB=AA=A8=EB=93=9C=EC=9D=B8=20=EA=B2=BD=EC=9A=B0=20timeFormat?= =?UTF-8?q?=EC=9D=B4=20=EC=97=86=EC=9D=84=20=EB=95=8C=20shortcut=ED=81=B4?= =?UTF-8?q?=EB=A6=AD=20=EC=95=88=EB=90=98=EB=8A=94=20=EB=B2=84=EA=B7=B8=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/datePicker/uses.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/components/datePicker/uses.js b/src/components/datePicker/uses.js index 5852735ff..d15862883 100644 --- a/src/components/datePicker/uses.js +++ b/src/components/datePicker/uses.js @@ -333,16 +333,21 @@ export const useShortcuts = (param) => { } const shortcutDate = targetShortcut.shortcutDate; + const timeFormat = props.options?.timeFormat; if (isRange) { const [fromDate, toDate] = shortcutDate(); if (props.mode === 'dateTimeRange') { - const [fromTimeFormat, toTimeFormat] = props.options?.timeFormat; - - mv.value = [ - getChangedValueByTimeFormat(fromTimeFormat, formatDateTime(fromDate)), - getChangedValueByTimeFormat(toTimeFormat, formatDateTime(toDate)), - ]; + if (timeFormat?.length) { + const [fromTimeFormat, toTimeFormat] = timeFormat; + + mv.value = [ + getChangedValueByTimeFormat(fromTimeFormat, formatDateTime(fromDate)), + getChangedValueByTimeFormat(toTimeFormat, formatDateTime(toDate)), + ]; + } else { + mv.value = [formatDateTime(fromDate), formatDateTime(toDate)]; + } } else { mv.value = [formatDate(fromDate), formatDate(toDate)]; } @@ -350,7 +355,7 @@ export const useShortcuts = (param) => { const sDate = shortcutDate(); mv.value = props.mode === 'dateTime' ? getChangedValueByTimeFormat( - props.options?.timeFormat, + timeFormat, formatDateTime(sDate)) : formatDate(sDate); }