Skip to content

Commit

Permalink
Handle dates
Browse files Browse the repository at this point in the history
  • Loading branch information
mikmart committed Jan 23, 2024
1 parent 5d47852 commit 68d6913
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions inst/htmlwidgets/datatables.js
Original file line number Diff line number Diff line change
Expand Up @@ -674,8 +674,12 @@ HTMLWidgets.widget({
});
// we only know how to use function renderers
if (colDef && typeof colDef.render === 'function') {
$span1.text(colDef.render(scaleBack(v1, scale), 'display'));
$span2.text(colDef.render(scaleBack(v2, scale), 'display'));
var restore = function(v) {
v = scaleBack(v, scale);
return type !== 'date' ? v : new Date(+v);
}
$span1.text(colDef.render(restore(v1), 'display'));
$span2.text(colDef.render(restore(v2), 'display'));
} else {
$span1.text(formatDate(v1, false));
$span2.text(formatDate(v2, false));
Expand Down

0 comments on commit 68d6913

Please sign in to comment.