mirror of
https://github.com/tenrok/vue2-datepicker.git
synced 2026-06-24 02:40:35 +03:00
add customFormatter prop
This commit is contained in:
@@ -76,6 +76,9 @@ export default {
|
|||||||
type: String,
|
type: String,
|
||||||
default: 'yyyy-MM-dd'
|
default: 'yyyy-MM-dd'
|
||||||
},
|
},
|
||||||
|
customFormatter: {
|
||||||
|
type: Function
|
||||||
|
},
|
||||||
range: {
|
range: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
@@ -334,6 +337,9 @@ export default {
|
|||||||
return str
|
return str
|
||||||
},
|
},
|
||||||
stringify (date) {
|
stringify (date) {
|
||||||
|
if (typeof this.customFormatter === 'function') {
|
||||||
|
return this.customFormatter(new Date(date))
|
||||||
|
}
|
||||||
return this.formatDate(new Date(date), this.format)
|
return this.formatDate(new Date(date), this.format)
|
||||||
},
|
},
|
||||||
isValidDate (date) {
|
isValidDate (date) {
|
||||||
|
|||||||
Reference in New Issue
Block a user