function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
vishnu kalathuru 9vishnu kalathuru 9 

lightning:dataTable in lightning component having attributesTypes for Date in controller is not working as expected

<lightning:datatable data="{!v.Equipments}"    columns="{!v.equipmentColumns}"    keyField="Id"    hideCheckboxColumn="true"/> 
In Controller:
component.set('v.equipmentColumns', [
          {label: 'Predicted Time', fieldName: 'Prediction_Time__c', type: 'Date', typeAttributes:{year:'numeric',month:'short',day:'2-digit'}},
          {label: 'Origin Station', fieldName: 'Origin_Station__c', type: 'text', sortable: true},
          {label: 'Destintion Station', fieldName: 'Destination_Station__c', type: 'text', sortable: true},
      ]);

Currently it is displaying the date as : 2018-03-15T17:37:00.000Z
but the expected format is : 2018-03-15

Please help
 
Best Answer chosen by vishnu kalathuru 9
vishnu kalathuru 9vishnu kalathuru 9
solved the issue by changing type="Date" to type='date'

All Answers

Amit Singh 1Amit Singh 1
Try to remove the typeAttributes from the column
vishnu kalathuru 9vishnu kalathuru 9
Hi Amit....I need to format the date in lightning:datatable component...without typeAttribute also i m getting same output which is not in expected format.
vishnu kalathuru 9vishnu kalathuru 9
solved the issue by changing type="Date" to type='date'
This was selected as the best answer
sai prakash 14sai prakash 14
hai, i want to display in dd/mm/yyyy in this format can anyone help me on this date format
Vikas Tiwari 29Vikas Tiwari 29
Check some parameter formatting here, hope this will help : https://sfdcpanther.wordpress.com/2018/01/02/top-10-features-for-lightning-development-spring-18-release/