Safari browser gives a syntax error when i try to display the date format in
dd/mm/yyyy
format. Is there any solution how to display them using jquery? Thanks in advance
function parseDate(input) {
var d= new Date(input);
return d.format("dd-mm-yyyy");//"dd/mm/yyyy"
}//works on chrome not in safari
I’ve created a quick demo of your example code using the date format plugin, fiddle here and it appears to work fine in Safari.
Things to try:
inputis a valid date objectFailing that, please provide more information about the error Safari gives you.
UPDATE
As you’ve now said you’re passing a string to the
Date()object, I can see the problem. Safari is very strict about what it will accept, so you’ll need to parse the string first, to form a validDateobject. Try the below:You can test it in this fiddle: http://jsfiddle.net/Ly4vb/1/