You need to sign in to do that
Don't have an account?
chip5
setting a date field to null in a lightning component attribute (Lightning Components Basics trail)
In the Lightning Components Basics trail, you create a component which includes an Expense__c attribute that has a Date field called Date__c.
The problem is that assigning '' or null to Date__c is producing this error in the console:
<lightning:formattedDateTime> the value attribute accepts either a Date object, a timestamp, or a valid ISO8601 formatted string with timezone offset. but we are getting the value "null" instead.
formattedDateTime.js:formatted:31
The error happens on page load when the default value is being loaded for newExpense. For initialization, it's not an issue because the date UI element is defaulting to blank anyway, the problem is later when I want to set the date to blank from javascript and I get the same error.
<aura:attribute name="newExpense" type="Expense__c" default="{ 'sobjectType': 'Expense__c', 'Name': '', 'Amount__c': 0, 'Client__c': '', 'Date__c': '', 'Reimbursed__c': false }"/>
The problem is that assigning '' or null to Date__c is producing this error in the console:
<lightning:formattedDateTime> the value attribute accepts either a Date object, a timestamp, or a valid ISO8601 formatted string with timezone offset. but we are getting the value "null" instead.
formattedDateTime.js:formatted:31
The error happens on page load when the default value is being loaded for newExpense. For initialization, it's not an issue because the date UI element is defaulting to blank anyway, the problem is later when I want to set the date to blank from javascript and I get the same error.
Best Answer chosen by chip5
chip5
nevermind, the message about date formats is just a warning, not an error. The reason my update wasn't happening was because of the fact that component events only go up the hierarchy. I switched to an application event and it worked.