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

c - Compilation of a code: unkown type name string -

ubuntu - Bash Script to Check That Files Are Being Created -

Php operator `break` doesn't stop while -