Possibility to set time in date selector
When you have a datetime field in sql the edit form only lets you set the date and not the time. So all input is registered as 00:00:00. It should also be possible to add the time.
It has been added as set_col_datetime() method to be released as 6.52.
-
Sten Lomme commented
Just adding to the article noticed by Richard concerning https://phpgrid.uservoice.com/knowledgebase/articles/329226-datetime-in-datepicker:
For perfect editing of date, time, datetime and timestamp fields, use the following steps instead of the article:
1) in cls_datagrid.php, find display_script_includeonce() functon and include the following jquery-ui-timepicker-addon.js file.
$this->script_includeonce .='<script src="'. ABS_PATH .'/js/jquery-ui-timepicker-addon.js" type="text/javascript"></script>' ."\n";
2) Replace the following lines of code (yes...comment them all out)
$editoptions['dataInit'] = '###function(el){$(el).datetimepicker({dateFormat:\''.
(isset($this->col_formats[$col_name]['date'])?
$this->col_formats[$col_name]['date']['datePickerFormat']:
'yy-mm-dd').'\'});}###';3) And insert this code instead:
$metacolumn = $this_db->field_metacolumn($this->sql_table, $col_name); // get column types from adodb
if ($metacolumn->type == 'datetime' || $metacolumn->type == 'timestamp') {
$editoptions['dataInit'] = '###function(el){$(el).datetimepicker({dateFormat:\''.
(isset($this->col_formats[$col_name]['datetime'])?
$this->col_formats[$col_name]['datetime']['datetimePickerFormat']:
'yy-mm-dd').'\'});}###';
}elseif ($metacolumn->type == 'time') {
$editoptions['dataInit'] = '###function(el){$(el).timepicker({dateFormat:\''.
(isset($this->col_formats[$col_name]['time'])?
$this->col_formats[$col_name]['time']['timePickerFormat']:
'HH:mm:ss').'\'});}###';
}elseif ($metacolumn->type == 'date') {
$editoptions['dataInit'] = '###function(el){$(el).datepicker({dateFormat:\''.
(isset($this->col_formats[$col_name]['date'])?
$this->col_formats[$col_name]['date']['datePickerFormat']:
'yy-mm-dd').'\'});}###';
}