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:
parent
cbb7e95276
commit
5a4426300a
@ -10,18 +10,37 @@ const DATEPICKER_INITIALIZED_CLASS = 'datepicker--initialized';
|
|||||||
|
|
||||||
const DATEPICKER_CONFIG = {
|
const DATEPICKER_CONFIG = {
|
||||||
'global': {
|
'global': {
|
||||||
|
// minimize overlaps with other date inputs
|
||||||
position: 'right',
|
position: 'right',
|
||||||
locale: 'de', // TODO: hardcoded
|
|
||||||
weekStart: 1, // TODO: hardcoded
|
// set default time to 00:00:00
|
||||||
stayOpen: true, // to prevent the instance from closing when selecting a date before selecting a time
|
// 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,
|
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': {},
|
'datetime-local': {},
|
||||||
'date': {
|
'date': {
|
||||||
|
// disable date picker
|
||||||
timeFormat: false,
|
timeFormat: false,
|
||||||
},
|
},
|
||||||
'time': {
|
'time': {
|
||||||
|
// disable time picker
|
||||||
dateFormat: false,
|
dateFormat: false,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user