Skip to content

Commit

Permalink
Merge #16776 - Fix #15629 - datetime decimal displayed (.0000) after …
Browse files Browse the repository at this point in the history
…edit

Pull-request: #16776
Fixes: #15629

Signed-off-by: William Desportes <williamdes@wdes.fr>
  • Loading branch information
williamdes committed Mar 31, 2021
2 parents a3e725a + 5a6e071 commit b6398cf
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions js/src/makegrid.js
Expand Up @@ -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';
Expand Down

0 comments on commit b6398cf

Please sign in to comment.