🌐 AI搜索 & 代理 主页
Skip to content

Commit c26227a

Browse files
committed
fix(b-form-datepicker): valueAsDate prop handling
1 parent 3cf2465 commit c26227a

File tree

1 file changed

+22
-12
lines changed

1 file changed

+22
-12
lines changed

src/components/form-datepicker/form-datepicker.js

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@ const {
2525
props: modelProps,
2626
prop: MODEL_PROP_NAME,
2727
event: MODEL_EVENT_NAME
28-
} = makeModelMixin('value', {
29-
type: PROP_TYPE_STRING,
30-
defaultValue: ''
31-
})
28+
} = makeModelMixin('value', { type: PROP_TYPE_DATE_STRING })
3229

3330
// --- Props ---
3431

@@ -220,7 +217,11 @@ export const BFormDatepicker = /*#__PURE__*/ Vue.extend({
220217
h(
221218
BButton,
222219
{
223-
props: { size: 'sm', disabled: disabled || readonly, variant: this.todayButtonVariant },
220+
props: {
221+
disabled: disabled || readonly,
222+
size: 'sm',
223+
variant: this.todayButtonVariant
224+
},
224225
attrs: { 'aria-label': label || null },
225226
on: { click: this.onTodayButton }
226227
},
@@ -235,7 +236,11 @@ export const BFormDatepicker = /*#__PURE__*/ Vue.extend({
235236
h(
236237
BButton,
237238
{
238-
props: { size: 'sm', disabled: disabled || readonly, variant: this.resetButtonVariant },
239+
props: {
240+
disabled: disabled || readonly,
241+
size: 'sm',
242+
variant: this.resetButtonVariant
243+
},
239244
attrs: { 'aria-label': label || null },
240245
on: { click: this.onResetButton }
241246
},
@@ -250,7 +255,11 @@ export const BFormDatepicker = /*#__PURE__*/ Vue.extend({
250255
h(
251256
BButton,
252257
{
253-
props: { size: 'sm', disabled, variant: this.closeButtonVariant },
258+
props: {
259+
disabled,
260+
size: 'sm',
261+
variant: this.closeButtonVariant
262+
},
254263
attrs: { 'aria-label': label || null },
255264
on: { click: this.onCloseButton }
256265
},
@@ -281,8 +290,9 @@ export const BFormDatepicker = /*#__PURE__*/ Vue.extend({
281290
staticClass: 'b-form-date-calendar w-100',
282291
props: {
283292
...pluckProps(calendarProps, $props),
284-
value: localYMD,
285293
hidden: !this.isVisible,
294+
value: localYMD,
295+
valueAsDate: false,
286296
width: this.calendarWidth
287297
},
288298
on: {
@@ -311,13 +321,13 @@ export const BFormDatepicker = /*#__PURE__*/ Vue.extend({
311321
staticClass: 'b-form-datepicker',
312322
props: {
313323
...pluckProps(formBtnLabelControlProps, $props),
314-
id: this.safeId(),
315-
value: localYMD,
316324
formattedValue: localYMD ? this.formattedValue : '',
325+
id: this.safeId(),
326+
lang: this.computedLang,
327+
menuClass: [{ 'bg-dark': dark, 'text-light': dark }, this.menuClass],
317328
placeholder,
318329
rtl: this.isRTL,
319-
lang: this.computedLang,
320-
menuClass: [{ 'bg-dark': dark, 'text-light': dark }, this.menuClass]
330+
value: localYMD
321331
},
322332
on: {
323333
show: this.onShow,

0 commit comments

Comments
 (0)