I'm seeing some surprising behavior adding a duration to a moment:
var moment = require('moment');
var now = new moment();
var halfday = moment.duration(1/2, 'd');
var fullday = moment.duration(1, 'd');
var day_ago = now.clone().subtract(fullday);
var halfday_ago = now.clone().subtract(halfday);
var otherhalf_ago = now.clone().subtract(halfday.as('ms'));
if (day_ago.isSame(halfday_ago)) { console.log("surprise!"); }
if (!halfday_ago.isSame(otherhalf_ago)) { console.log("surprise!"); }
examining the actual dates, subtracting halfday subtracts a full day (and adding halfday adds nothing). doing the computation with halfday.as('ms') produces the correct result. The momentjs code is pretty opaque in this regard, is this expected behavior?