I have a Visualforce page in which I try to compare 2 dates.
The code:
<apex:page StandardController="Account">
<script>
window.document.onload = new function(e)
{
alert("{!Account.Support_End_Date__c}");
alert("{!NOW()}");
if({!Account.Support_End_Date__c} <= {!NOW()})
{
alert("Customer is NOT under Support.");
}
}
</script>
</apex:page>
Is not working correctly.
I want the pop up to display if the support_end_date is smaller than today/now.
UPDATE
by changing my code to the following (sorry for duplication, I think it may help others)
if("{!Account.Support_End_Date__c}" <= "{!NOW()}")
{
alert("Customer is NOT under Support \nor not date is given.");
}
I get the script to complete successfully, however, the behavior is not as requested - both dates are returned as formatted strings. How do I compare them?