datatablesangular8angular-datatables

Property 'moment' does not exist on type 'StaticRenderFunctions'.ts(2339


I'm trying to use datetime plugin with datatables-angular to render the format of Date time inside the data table :

:
:
 columnDefs: [

     {  targets:3,render: $.fn.dataTable.render.moment( 'Do MMM YYYYY' ) },

but the Angular data table does not recognize the .moment function because I didn't download datatime plugin I'm wondering of how could I download this plugin by npm, or how could I use it


Solution

  • I found the solution without downloading datetime plugin

    simply what I did is below :

    columnDefs: [
      {  targets:9,render:function(data){
     var dt=new Date(data);
     return dt.getFullYear() + "/" + (dt.getMonth() + 1) + "/" + dt.getDate();
    }},
    ]