You need to sign in to do that
Don't have an account?
aam1r
Date processing in Lightning Datatable
Hi Everyone,
I'm passing a salesforce record that includes date fields to a Lightning compnent's helper class. The page renders a Lightning datatable and displays the results as expected. However, the page loads and runs very slow. Looking at the console logs i can see a huge count of warnings, which i believe is the culprit. The message that pops up for these logs is as follows:
"<lightning-formatted-date-time> The value attribute accepts either a Date object, a timestamp, or a valid ISO8601 formatted string with timezone offset. but we are getting the object value "Invalid Date" instead."
The Helper class defines the columns and teh formatting as:
I'm guessing it's some issue with how JS and Apex communicate dates but i'm very new to JS so cannot figure out what the issue could be. Very sorry if teh question is not detailed abundantly. If someone can give some guidance it would be great, as i really want to rid this error. It takes too long to load the page with anything more than a a hundred records.
Thanks
Aamir
I'm passing a salesforce record that includes date fields to a Lightning compnent's helper class. The page renders a Lightning datatable and displays the results as expected. However, the page loads and runs very slow. Looking at the console logs i can see a huge count of warnings, which i believe is the culprit. The message that pops up for these logs is as follows:
"<lightning-formatted-date-time> The value attribute accepts either a Date object, a timestamp, or a valid ISO8601 formatted string with timezone offset. but we are getting the object value "Invalid Date" instead."
The Helper class defines the columns and teh formatting as:
{label: 'Ordered Date', fieldName: 'Ordered_Date__c', type: 'date', typeAttributes:{year: 'numeric', month:'numeric',day:'numeric'} }The component utilises the datatable and renders the data correctly but very slow. Here is the use of the datatable:
<lightning:datatable aura:id="datatable" data="{! v.data }" columns="{! v.columns }" >The v.data receives the List<Object> from apex and the v.columns is defined in the helper.js class.
I'm guessing it's some issue with how JS and Apex communicate dates but i'm very new to JS so cannot figure out what the issue could be. Very sorry if teh question is not detailed abundantly. If someone can give some guidance it would be great, as i really want to rid this error. It takes too long to load the page with anything more than a a hundred records.
Thanks
Aamir
Please post your lightning component code so that we can suggest you to improve performancee.
Also a screenshot of your console.logs to understand what warnings you are gettting
and above I see that data table syntax is Aura and lightning formated date time in lwc tag. Am I missing something?
COMPONENT: CONTROLLER.JS HELPER.JS APEX CONTROLLER
Please bear in mind this is work in porgress and at present i'm trying to solve why i get a large numbr of console logging around "lightning-formatted-date-time". The numbers in thsi screenshot are in dev. when live in prod it goes into 1000s which haults the application for some time..
Expanded:
Any help is greatly appreciated.
Aamir
In order to get access to the individual formatting options on the component i switched over to a custom table with iteration instead of lightning datatable. Initially i faced the same performance issue and warnings as before when using: But then i switched to the following and it it resolved the issue: And i applied the same to every date field to completely remove the warnings i was getting.
I'll still love to know how to get around this using the lightning datatable. But for now, i'm happy this is resolved. Thanks to whoever tried looking in to this.
Aamir
With LWC if you specify the below then the warnings go away. i was also facing the same issue that you specified in screenshot. Below should help when you are defining your columns But my issue is i dont want to see the time component. Even though i specify the type as date i still see the time component with date picker. But i hope it solves your issue