Not sure why are you using format while you need to compare dates, you should compare the date value to check if the due date is missed by 30 days
var datePast30Days = moment().subtract(30, days);
$(function () {
$('p').each(function (index, element) {
var $element = $(element);
var dueDate = moment($element.text(), 'M/D/YYYY');
if(dueDate< datePast30Days) {
}
})
});
for details read moment docs @
Moment.js | Docs[
^]