Skip to content

Commit

Permalink
expose formatType to custom element, fix#56
Browse files Browse the repository at this point in the history
  • Loading branch information
mskocik committed Sep 28, 2022
1 parent c113f44 commit 7ffd043
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/lib/custom-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import SveltyPicker, { config } from "./components/SveltyPicker.svelte";

const OPTION_LIST = [
'value', 'name', 'placeholder', 'start-date', 'end-date', 'disabled', 'input-classes',
'mode', 'format', 'week-start', 'today-btn', 'clear-btn', 'autoclose', 'required'
'mode', 'format', 'format-type', 'week-start', 'today-btn', 'clear-btn', 'autoclose', 'required'
];

function formatValue(name, value) {
Expand Down Expand Up @@ -89,6 +89,15 @@ class PickerElement extends HTMLInputElement {
val && this.setAttribute('input-classes', val)
!val && this.removeAttribute('input-classes');
}
},
'formatType': {
get() {
return this.getAttribute('format-type');
},
set(val) {
val && ['standard', 'php'].includes(val) && this.setAttribute('format-type', val);
!val && this.removeAttribute('format-type');
}
}
}
const boolProps = ['required', 'disabled', 'today-btn', 'clear-btn','autoclose']
Expand Down

0 comments on commit 7ffd043

Please sign in to comment.