javascript moment.js脚本不能正常工作

时间:2018-05-03 08:50:29

标签: javascript momentjs

以下代码:if(exDate.isBefore(today)||!exDate) - > !exDate代码不起作用。谁能帮我?我试图根据到期日计算ef FEE。 http://verlager.com/account-pure.php代码必须包含**成员> “”**

function calcEntryFee( elem ) {
var idx, member, exDate, today, fee;

elem = elem || {};
if ( /^[PEMX](\d+)$/.test( elem.id ) ) {
    idx = RegExp.$1;
} else {
    return false;
}

member = getMemberData( jQuery( '#P' + idx ).val() );
mmfee = parseFloat( jQuery( '#M' + idx ).val() );
//exDate = moment( member.Expires, 'YYYY.MM.DD' );
exDate = member && member.Expires && member.Expires !== '' ? moment( member.Expires, 'YYYY.MM.DD' ) : null
today = moment();
fee = '';

if ( (!exDate || !exDate.isValid() || exDate.isBefore( today )) && (member.Name > '')) {fee = 5;} // this just doesn't work.

if (!exDate) 
{
    fee = 5;
} else if ( exDate.isSameOrAfter( today ) ) {
    fee = 3;
} else if ( ! member.Expires && mmfee > 0 ) {
    fee = 0;
} 

// Updates the entry fee input value.
jQuery( '#E' + idx ).val( fee );

return fee;
}

0 个答案:

没有答案