Skip to content

Commit

Permalink
fix(VDatePicker): display proper year when model is null (#5672)
Browse files Browse the repository at this point in the history
fixes #5663
  • Loading branch information
jacekkarczmarczyk authored Dec 1, 2018
1 parent 595e85c commit 78339a3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/vuetify/src/components/VDatePicker/VDatePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ export default {
props: {
date: this.value ? this.formatters.titleDate(this.value) : '',
selectingYear: this.activePicker === 'YEAR',
year: this.formatters.year(`${this.inputYear}`),
year: this.formatters.year(this.value ? `${this.inputYear}` : this.tableDate),
yearIcon: this.yearIcon,
value: this.multiple ? this.value[0] : this.value
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@ test('VDatePicker.js', ({ mount, compileToFunctions }) => {
expect(header.text()).toBe('November 2005')
})

it('should display the correct year when model is null', () => {
const wrapper = mount(VDatePicker, {
propsData: {
value: null,
pickerDate: '2013-01'
}
})

const year = wrapper.find('.v-date-picker-title__year')[0]

expect(year.text()).toBe('2013')
})

it('should match snapshot with default settings', () => {
const wrapper = mount(VDatePicker, {
propsData: {
Expand Down

0 comments on commit 78339a3

Please sign in to comment.