You need to sign in to do that
Don't have an account?
vishnu 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
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
All Answers