Skip to content

Commit

Permalink
fix(b-form-datepicker): valueAsDate prop handling (#6159)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobmllr95 authored Dec 8, 2020
1 parent 3cf2465 commit 5cb8e0c
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions src/components/form-datepicker/form-datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ const {
props: modelProps,
prop: MODEL_PROP_NAME,
event: MODEL_EVENT_NAME
} = makeModelMixin('value', {
type: PROP_TYPE_STRING,
defaultValue: ''
})
} = makeModelMixin('value', { type: PROP_TYPE_DATE_STRING })

// --- Props ---

Expand Down Expand Up @@ -220,7 +217,11 @@ export const BFormDatepicker = /*#__PURE__*/ Vue.extend({
h(
BButton,
{
props: { size: 'sm', disabled: disabled || readonly, variant: this.todayButtonVariant },
props: {
disabled: disabled || readonly,
size: 'sm',
variant: this.todayButtonVariant
},
attrs: { 'aria-label': label || null },
on: { click: this.onTodayButton }
},
Expand All @@ -235,7 +236,11 @@ export const BFormDatepicker = /*#__PURE__*/ Vue.extend({
h(
BButton,
{
props: { size: 'sm', disabled: disabled || readonly, variant: this.resetButtonVariant },
props: {
disabled: disabled || readonly,
size: 'sm',
variant: this.resetButtonVariant
},
attrs: { 'aria-label': label || null },
on: { click: this.onResetButton }
},
Expand All @@ -250,7 +255,11 @@ export const BFormDatepicker = /*#__PURE__*/ Vue.extend({
h(
BButton,
{
props: { size: 'sm', disabled, variant: this.closeButtonVariant },
props: {
disabled,
size: 'sm',
variant: this.closeButtonVariant
},
attrs: { 'aria-label': label || null },
on: { click: this.onCloseButton }
},
Expand Down Expand Up @@ -281,8 +290,9 @@ export const BFormDatepicker = /*#__PURE__*/ Vue.extend({
staticClass: 'b-form-date-calendar w-100',
props: {
...pluckProps(calendarProps, $props),
value: localYMD,
hidden: !this.isVisible,
value: localYMD,
valueAsDate: false,
width: this.calendarWidth
},
on: {
Expand Down Expand Up @@ -311,13 +321,13 @@ export const BFormDatepicker = /*#__PURE__*/ Vue.extend({
staticClass: 'b-form-datepicker',
props: {
...pluckProps(formBtnLabelControlProps, $props),
id: this.safeId(),
value: localYMD,
formattedValue: localYMD ? this.formattedValue : '',
id: this.safeId(),
lang: this.computedLang,
menuClass: [{ 'bg-dark': dark, 'text-light': dark }, this.menuClass],
placeholder,
rtl: this.isRTL,
lang: this.computedLang,
menuClass: [{ 'bg-dark': dark, 'text-light': dark }, this.menuClass]
value: localYMD
},
on: {
show: this.onShow,
Expand Down

0 comments on commit 5cb8e0c

Please sign in to comment.