I want to display a date value in a input field from my database at start and only change it if I change the picker values.
As it is now, it displays the current date/time in the input field instead of the value from my database.
So how can I prevent it from displaying the pickervalue?
var today = new Date();
var pickerKalenderUpdate = app.picker.create({
inputEl: '#picker-date-kalender-update',
toolbar: true,
toolbarCloseText : 'STÄNG',
rotateEffect: true,
openIn: 'popover',
value: [today.getFullYear(), today.getMonth()+1, today.getDate(), (today.getHours() < 10 ? '0' + today.getHours() : today.getHours()), (today.getMinutes() < 10 ? '0' + today.getMinutes() : today.getMinutes())],
formatValue: function (values, displayValues) {
return values[0] + '-' + (values[1]< 10 ? '0' + values[1] : values[1]) + '-' + (values[2]< 10 ? '0' + values[2] : values[2]) + ' ' + values[3] + ':' + values[4];
},
cols: [
// Years
{
values: (function () {
var arr = [];
for (var i = 1950; i <= 2030; i++) { arr.push(i); }
return arr;
})(),
},
// Space divider
{
divider: true,
content: '-'
},
// Months
{
values: ('1 2 3 4 5 6 7 8 9 10 11 12').split(' '),
displayValues: ('01 02 03 04 05 06 07 08 09 10 11 12').split(' '),
//textAlign: 'left'
},
// Space divider
{
divider: true,
content: '-'
},
// Days
{
values: [01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31],
//displayValues: ('01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31').split(','),
},
// Space divider
{
divider: true,
content: ' '
},
// Hours
{
values: (function () {
var arr = [];
for (var i = 0; i <= 23; i++) { arr.push(i < 10 ? '0' + i : i); }
return arr;
})(),
},
// Divider
{
divider: true,
content: ':'
},
// Minutes
{
values: (function () {
var arr = [];
for (var i = 0; i <= 59; i++) { arr.push(i < 10 ? '0' + i : i); }
return arr;
})(),
}
],
on: {
change: function (picker, values, displayValues) {
var daysInMonth = new Date(picker.value[2], picker.value[0]*1 + 1, 0).getDate();
if (values[1] > daysInMonth) {
picker.cols[1].setValue(daysInMonth);
}
},
}
});
Thanks.