2

Is there a helper utility for Lightning components to convert values from Datetime objects into a deserialized value? I have two Datetime values in Custom Settings...

My_Start_Date__c
My_End_Date__c

...and my Lightning component is getting back serialized values:

My_Start_Date__c: "2020-06-01T19:17:00.000Z"
My_End_Date__c: "2020-07-01T04:30:00.000Z"

Are they any Lightning features that will deserialize this, or is that something that I will need to convert to on my own in order to be able to effectively read the timestamp?

1

You can use the Date constructor:

let startDate = new Date(record.My_Start_Date__c);

From there, you can use other Date methods for formatting, adjusting, etc.

Note that this is a standard JavaScript feature, which is why there's no need for a "LWC-only" add-on utility.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.