diff --git a/template/templates/money_deposit_create.tpl b/template/templates/money_deposit_create.tpl index 85fbc53..52128ed 100644 --- a/template/templates/money_deposit_create.tpl +++ b/template/templates/money_deposit_create.tpl @@ -97,9 +97,13 @@ if (pdata['l_expire_type'] == '1') { //var today = new Date(); - var today = new Date($('#mod_date').val()); + var today = new Date($('#mod_date').val() + " 00:00:00"); //var nextMonthBeginning = new Date(today.getFullYear(), today.getMonth() + 1, 1); var lastDayOfMonth = new Date(today.getFullYear(), today.getMonth()+1, 0); + //console.log(lastDayOfMonth, today, lastDayOfMonth.getTime() === today.getTime()); + if (lastDayOfMonth.getTime() === today.getTime()) { + lastDayOfMonth = new Date(today.getFullYear(), today.getMonth()+2, 0); + } $('#expire_date').html(lastDayOfMonth.getFullYear() + '-' + ('0' + (lastDayOfMonth.getMonth()+1)).slice(-2) + '-' + ('0' + lastDayOfMonth.getDate()).slice(-2)); $('#mod_expire_date').val(lastDayOfMonth.getFullYear() + '-' + ('0' + (lastDayOfMonth.getMonth()+1)).slice(-2) + '-' + ('0' + lastDayOfMonth.getDate()).slice(-2));