on grocerycrud, when I create a table with a datetime data type, then it will generate groocerycrud filed with the datetime format (yy-mm-dd hh:mm).
the problem arises when I add data. I can not enter data,coz datetime that I choose on datepicker, does not look into the textfield. when I edit data it’s no problem with datepicker. the problem when I add data.
so how to fix it?
Screenshot
UPS 😖 I think you’re right this is a BUG. I will look at it and send you which line to change
I found the bug. Go at the file : public/grocery_crud/js/jquery_plugins/jquery.ui.datetime.js and go to the line 203 and replace the function parseTime with the code below:
function parseTime (obj) {
if($(obj).val() != '')
var time = ($(obj).val() || $(this).val()).split(" ");
else
var time = ['00-00-00','00:00:00'];
if (time.length < 2) {
time = ['00-00-00','00:00:00'];
}
$('#pickerplug').data('lastdate',time[0]); //lastdate = time[0];
$('#pickerplug').data('lasttime',time[1]); //lasttime = time[1];
time = time[1].split(":");
if (time.length < 2) {
time = ['00','00','00'];
}
var hour = time[0] || '00';
var minute = time[1] || '00';
writeTime(hour,'hour');
writeTime(minute,'minute');
$('#hourSlider').slider('option', 'value', hour);
$('#minuteSlider').slider('option', 'value', minute);
var zero_string = "0";
if( $('#pickerplug').data('lastdate').charAt(0) != zero_string.charAt(0) )
{
$('#datepicker').datepicker( 'setDate',
$.datepicker.parseDate(
datepicker_def['dateFormat'],
$('#pickerplug').data('lastdate')
)
);
}
else
{
$('#datepicker').datepicker( 'setDate',
$.datepicker.parseDate(
datepicker_def['dateFormat'],
''
)
);
}
}