Merge #16776 - Fix #15629 - datetime decimal displayed (.0000) after edit

Pull-request: #16776
Fixes: #15629

Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
William Desportes 2021-03-31 13:08:16 +02:00
commit b6398cfe17
No known key found for this signature in database
GPG Key ID: 90A0EF1B8251A889

View File

@ -683,14 +683,16 @@ var makeGrid = function (t, enableResize, enableReorder, enableVisib, enableGrid
var newHtml = Functions.escapeHtml(value);
newHtml = newHtml.replace(/\n/g, '<br>\n');
var decimals = parseInt($thisField.attr('data-decimals'));
// remove decimal places if column type not supported
if (($thisField.attr('data-decimals') === 0) && ($thisField.attr('data-type').indexOf('time') !== -1)) {
if ((decimals === 0) && ($thisField.attr('data-type').indexOf('time') !== -1)) {
newHtml = newHtml.substring(0, newHtml.indexOf('.'));
}
// remove addtional decimal places
if (($thisField.attr('data-decimals') > 0) && ($thisField.attr('data-type').indexOf('time') !== -1)) {
newHtml = newHtml.substring(0, newHtml.length - (6 - $thisField.attr('data-decimals')));
// remove additional decimal places
if ((decimals > 0) && ($thisField.attr('data-type').indexOf('time') !== -1)) {
newHtml = newHtml.substring(0, newHtml.length - (6 - decimals));
}
var selector = 'span';