I am trying to pass a datetime field to a Javascript function:
onclick="myfunction('{!c.ID}',
'{!c.Start_Date__c}',
'{!c.Reason__c}');"
This passes the default formatted Apex datetime which looks like this: MON Jan 01 14:00:00 GMT 2018
Javascript does not parse this as a date. So I need something formatted in a way that JS recognizes as a date (unless I want to parse it myself).
I have tried:
onclick="myfunction('{!c.ID}',
'{!(c.Start_Date__c).format()}',
'{!c.Reason__c}');"
But that doesn't work. I have also tried added parentheses:
'{!((c.Start_Date__c).format())}',
No luck with that either. I am trying to avoid having to parse the string myself in JS. Any suggestions?