mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
28 lines
707 B
JavaScript
28 lines
707 B
JavaScript
|
|
import { Spanish } from "../../../../themes/vuexy/vendor/libs/flatpickr/es.js"
|
|
|
|
class DatePicker {
|
|
constructor(domItem, options) {
|
|
this.item = domItem
|
|
this.options = options
|
|
this.itemDate = null;
|
|
this.init()
|
|
}
|
|
init() {
|
|
this.itemDate = this.item.flatpickr({ ...this.options, locale: Spanish })
|
|
|
|
}
|
|
setDateFormat(dateFormat = "dd/mm/yy") {
|
|
this.item.flatpickr("option", "dateFormat", dateFormat)
|
|
}
|
|
getDate() {
|
|
return this.itemDate.getDate()
|
|
}
|
|
setDate(date) {
|
|
if(!isNaN(new Date(date))){
|
|
this.itemDate.setDate(date,true,this.options.dateFormat)
|
|
}
|
|
}
|
|
}
|
|
|
|
export default DatePicker; |