From 85f46ef23075104346aba33861f8c170757a3c09 Mon Sep 17 00:00:00 2001 From: Sarah Vaupel Date: Wed, 14 Aug 2019 11:42:02 +0200 Subject: [PATCH] feat(datepicker): add option to change the position of the datepicker --- frontend/src/utils/form/datepicker.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frontend/src/utils/form/datepicker.js b/frontend/src/utils/form/datepicker.js index 83f748890..49fcf2025 100644 --- a/frontend/src/utils/form/datepicker.js +++ b/frontend/src/utils/form/datepicker.js @@ -75,6 +75,12 @@ export class Datepicker { const datepickerGlobalConfig = DATEPICKER_CONFIG['global']; const datepickerConfig = DATEPICKER_CONFIG[this._element.getAttribute('type')]; + // additional position config (optional data-datepicker-position attribute in html) that can specialize the global config + const datepickerPosition = this._element.dataSet.datepickerPosition; + if (datepickerPosition) { + datepickerGlobalConfig.position = datepickerPosition; + } + if (!datepickerConfig) { throw new Error('Datepicker utility called on unsupported element!'); }