momentjs - Moment js not working as expected -
i have date object:
sun apr 20 2014 11:48:33 gmt-0400 (edt)
i want able render 3 letter month , date, such "apr 20"
i trying use moment.js accomplish task, so:
moment(date_var).format('mmm d');
which spits out: "jun 25" instead of expected "apr 20".
running:
json.stringify(date_var)
produces:
2014-04-20t15:48:33.000z
thanks
demo: http://jsfiddle.net/nfmns/3/
html:
<strong>javascript </strong><span></span> <br/> <strong>moment </strong> <p></p>
code:
$(function(){ var day = new date(2014, 4, 20,11,48,33); moment().format(); var mome=moment(day); $('span').text(day); $('p').text(mome.format("mmm d")); });
Comments
Post a Comment