This Script date.format.js in http://stevenlevithan.com/assets/misc/date.format.js
var txt = 04/04;<br/> dateFormat(txt, “dd/mm/yyyy”); result : 04/04/2001
I Want Result : 04/04/2013
This Script date.format.js in http://stevenlevithan.com/assets/misc/date.format.js
var txt = 04/04;<br/> dateFormat(txt, “dd/mm/yyyy”); result : 04/04/2001
I Want Result : 04/04/2013
You are feeding the function an ambiguous date, don't expect a neat result.
In Firefox, I get "01/01/1970", but if I wrap 04/04 in quotes, so I believe what you I get invalid date, check the js file in line 38 to see why.
What you can do is add the current year pro grammatically like this http://jsfiddle.net/nabil_kadimi/c3Nsf/2/:
var txt = '04/04'; txt += '/' + (new Date()).getFullYear(); window.alert(dateFormat(txt, "dd/mm/yyyy")); You would want to read this wonderful article on date parsing idiosyncrasies between various browsers.
There are some rules of the thumb provided for working with dates and also about how Chrome is a more accepting browser than others in terms of date formats.
new Date('04/04')toWed Apr 04 2001 00:00:00, while FF givesInvalid Date