Skip to content

Commit

Permalink
allow function as a prop in DateInput
Browse files Browse the repository at this point in the history
  • Loading branch information
Charlie Kassel committed Apr 28, 2018
1 parent 97e74fd commit 19f16fc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ A datepicker Vue component. Compatible with Vue 2.x
- [Demo](#demo)
- [Install](#install)
- [Usage](#usage)
- [Date Formatting](#date-formatting)
- [Props](#available-props)
- [Events](#events)
- [Disabled dates](#disabled-dates)
Expand Down
2 changes: 1 addition & 1 deletion src/components/DateInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import DateUtils from '../utils/DateUtils'
export default {
props: {
selectedDate: Date,
format: String,
format: [String, Function],
translation: Object,
inline: Boolean,
id: String,
Expand Down
7 changes: 7 additions & 0 deletions test/unit/specs/DateInput/DateInput.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,11 @@ describe('DateInput', () => {
})
expect(wrapper.find('input').attributes().disabled).toBeDefined()
})

it('accepts a function as a formatter', () => {
wrapper.setMethods({
format: () => '!'
})
expect(wrapper.find('input').element.value).toEqual('!')
})
})

0 comments on commit 19f16fc

Please sign in to comment.