Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to change date format in ngx-csv package in angular

getFile(  ) 
{

      const object : any = this.dataSource
      const keys_to_keep = ['firstName', 'dateOfJoining'];
      const key = object.map(e => {
      e.dateOfJoining = moment(e.dateOfJoining).format('DD/MM/YYYY')
      const obj = {};
 keys_to_keep.forEach(k => obj[k] = e[k]
    )
  return obj;

});
  
    var options = 
    {
      fieldSeparator: ',',
      quoteStrings: '"',
      decimalseparator: '.',
      showLabels: true,
      showTitle: true,
      title: '',
      useBom: true,
      noDownload: false,
      headers: ["FirstName","DateOfJoining"]
    };
     new ngxCsv(key,"Title", options);
  }
 
PREVIOUS NEXT
Tagged: #change #date #format #package #angular
ADD COMMENT
Topic
Name
3+4 =