forked from ems-project/elasticms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
68 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { TempusDominus } from '@eonasdan/tempus-dominus' | ||
import '@eonasdan/tempus-dominus/src/scss/tempus-dominus.scss' | ||
import ChangeEvent from '../events/changeEvent' | ||
|
||
class Datetime { | ||
#iframes = [] | ||
|
||
load (target) { | ||
const datetimePickers = target.querySelectorAll('.datetime-picker') | ||
for (let i = 0; i < datetimePickers.length; i++) { | ||
const picker = new TempusDominus(datetimePickers[i], { | ||
display: { | ||
buttons: { | ||
today: true, | ||
clear: true, | ||
close: true | ||
} | ||
}, | ||
localization: { | ||
format: datetimePickers[i].dataset.dateFormat, | ||
startOfTheWeek: 1 | ||
}, | ||
restrictions: { | ||
daysOfWeekDisabled: JSON.parse(datetimePickers[i].dataset.dateDaysOfWeekDisabled), | ||
disabledHours: JSON.parse(datetimePickers[i].dataset.dateDisabledHours) | ||
} | ||
}) | ||
if (datetimePickers[i].dataset.dateLocale) { | ||
picker.locale(datetimePickers[i].dataset.dateLocale) | ||
} | ||
datetimePickers[i].addEventListener('change.td', function () { | ||
if (datetimePickers[i].classList.contains('ignore-ems-update')) { | ||
return | ||
} | ||
const event = new ChangeEvent(datetimePickers[i]) | ||
event.dispatch() | ||
}) | ||
} | ||
} | ||
} | ||
|
||
export default Datetime |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters