You need to sign in to do that
Don't have an account?
Christian Szandor Knapp
Aura Attribute of Type Date - issues with DML On Apex Controller Side
Hey all,
I am experiencing an issue with aura attributes of the type date.
So we got a comoponent with an aura attribute
We got a Apex Controller with a method like this one
Mind you:
the js controller sends myDate to the Apex Controller (set etc)
The Apex Controller requires Date type as parameter
The Apex Controller accepts myDate as Type Date for the method
But DML fails: incorrect format, the myDate in ApexController misses the time part the dml statement seems to require (2015-11-05 00:00:00 instead of 2015-11-05 only)
is this per chance a known issue?
Kind Regards,
Sz
I am experiencing an issue with aura attributes of the type date.
So we got a comoponent with an aura attribute
<aura:attribute name="dateToday" type="Date"/>
We got a Apex Controller with a method like this one
@auraEnabled public static insertDate(Date myDate){ //some code that sets the date on sObject.datefield insert sOBject; }
Mind you:
the js controller sends myDate to the Apex Controller (set etc)
The Apex Controller requires Date type as parameter
The Apex Controller accepts myDate as Type Date for the method
But DML fails: incorrect format, the myDate in ApexController misses the time part the dml statement seems to require (2015-11-05 00:00:00 instead of 2015-11-05 only)
is this per chance a known issue?
Kind Regards,
Sz
I would suggest trying the following:
yes, on apex controller side I did. The format was like any other date would show in system.debug.
On another note, I used on client controller side:
- which worked charmingly well for Chrome.
I did not work on iOS (iPhone 6) or Firefox: Had to drop a feature alltogether (prefil aura inputdate field with today()+7 for convenience) since the behaviour was rather erratic. It behaves like Aura was affected by the depracated warning showing up when running above code: https://github.com/moment/moment/issues/1407
Very frustrating alltogether, but again - I am not an expert in Clientside Javascript.
Regards,
Sz