javascript - MomentJS Day diff dates only excluding time -



javascript - MomentJS Day diff dates only excluding time -

is there way of comparing 2 dates without time momentjs

iv tried various formats cant seam work

i have working fine datetime

var expirydate = new date("11/13/2014 11:13:00"); var daysdiff = moment(expirydate).diff(moment(date.now()), 'days');

looking result 14 days no matter time of day

thanks

you can utilize startof function remove time components of both dates

moment(expirydate).startof('day').diff(moment(date.now()).startof('day'), 'days');

javascript momentjs

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -