You need to sign in to do that
Don't have an account?
Suhas GB 6
How to pass date fields from Apex controller to Lightning component?
Can someone please help me on the below issue.
How can I pass the date field (i.e. in an Object) from Apex controller to lightning component (i.e. having date type attribute)? So that once I fetch the date then I need to perform some action in Lightning component based on the Date it got from Apex controller.
How can I pass the date field (i.e. in an Object) from Apex controller to lightning component (i.e. having date type attribute)? So that once I fetch the date then I need to perform some action in Lightning component based on the Date it got from Apex controller.
<!-- Lightning Component -->
<aura:attribute name="currDate" type="Date"/>
// Apex Controller
@AuraEnabled
public static Date getDate() {
// Make sure that you return date field from the method
return Oppty.StartDate;
}
Controller.js
component.set("v.currDate", response.getReturnValue());
All Answers
<!-- Lightning Component -->
<aura:attribute name="currDate" type="Date"/>
// Apex Controller
@AuraEnabled
public static Date getDate() {
// Make sure that you return date field from the method
return Oppty.StartDate;
}
Controller.js
component.set("v.currDate", response.getReturnValue());