feat(datepicker): more sane datetime config

refactored global settings; (partial!) quickfix for time inconsistency between selected time and input value
This commit is contained in:
Sarah Vaupel 2019-08-13 18:26:16 +02:00
parent cbb7e95276
commit 5a4426300a

View File

@ -10,18 +10,37 @@ const DATEPICKER_INITIALIZED_CLASS = 'datepicker--initialized';
const DATEPICKER_CONFIG = {
'global': {
// minimize overlaps with other date inputs
position: 'right',
locale: 'de', // TODO: hardcoded
weekStart: 1, // TODO: hardcoded
stayOpen: true, // to prevent the instance from closing when selecting a date before selecting a time
// set default time to 00:00:00
// this is a workaround to prevent inconsistent dates in input field and datepicker
timeHours: 0,
timeMinutes: 0,
timeSeconds: 0,
// german settings
// TODO: hardcoded, get from current language / settings
locale: 'de',
weekStart: 1,
dateFormat: 'dd.mm.YYYY',
// prevent the instance from closing when selecting a date before selecting a time
stayOpen: true,
// hide the close button (we handle closing the datepicker manually by clicking outside)
closeButton: false,
dateFormat: 'dd.mm.YYYY', // TODO: hardcoded, get from setting
// disable the decades view because nobody will ever need it (i.e. cap the switch to the more relevant year view)
viewDecades: false,
},
'datetime-local': {},
'date': {
// disable date picker
timeFormat: false,
},
'time': {
// disable time picker
dateFormat: false,
},
};