I have a repeater which contains a list of dates from Apex. Within the visualforce page this is displayed correctly, I can see all of the dates as I would expect. I have recently extended this to include a command button which passes the date back to the custom controller in apex and then updates the record etc. This works fine.
More recently I have been trying to extend the functionality by using URL Hacking to prepopulate fields on a new record. It is mostly working with one key issue. Ultimately I cannot add the date to the URL using Javascript. Everything I have tried is incorrect. To explain a bit more (i've taken out some code to keep it concise):
Visualforce - Repeater
<apex:repeat rendered="{!currRecord.address__r.Type_Value__c= 2}" value="{!keyList}" var="newDate">
<apex:outputText value="{0,date, EEEE dd MMMM yy}">
<apex:param value="{!newDate}"/>
</apex:outputText>
<apex:commandButton value="Book {!newDate}" reRender="hidden" onclick="alert({!newDate}); " >
<apex:param name="setDate" id="param1" value="{!TEXT(newDate)}" assignTo="{!selectedDate}"/>
</apex:commandButton>
</apex:repeat>
When viewing the above the command button label value is correct, as is the value passed to Apex. However the alert is unrecogniseable: 0.0000011234 (sort of thing).
I have tried alert(new Date({!newDate})
but the it returns "invalid date". I have also tried this suggestions but it always returns 01 Jan 1970. Javascript remoting and apex date design pattern. I have also tried the alert(!{TEXT(newDate)});
without luck.
Edit: Note the date is currently formatted as DD/MM/YYYY within the button etc and Day DD Month YYYY within the outputText. if I simply print {!newDate} then it appears in this format: Fri Sep 22 00:00:00 GMT 2017
Any help to pass the current date value from the repeater to the javascript would be appreciated.
keyList
defined as in the controller?