2
0
mirror of https://github.com/tenrok/vue2-datepicker.git synced 2026-06-24 01:20:36 +03:00

add customFormatter prop

This commit is contained in:
mxie
2018-04-21 17:34:32 +08:00
parent 2cf26f518f
commit b8c642d51c
+6
View File
@@ -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) {