store correct expire date

This commit is contained in:
Ricsi
2019-10-12 14:20:09 +02:00
parent 4996283631
commit a51d912b68
5 changed files with 37 additions and 18 deletions

View File

@@ -52,7 +52,10 @@
<div>
<label for="mod_sum">Lejár:</label>
<div id="expire_date" style="padding-top: 6px;">Következő hónapban (alapértelmezett beállítás)</div>
<input type="hidden" name="mod_expire_date" id="mod_expire_date">
<div id="expire_date" style="padding-top: 6px;">
Következő hónapban (alapértelmezett beállítás)
</div>
</div>
<div>
@@ -98,15 +101,19 @@
//var nextMonthBeginning = new Date(today.getFullYear(), today.getMonth() + 1, 1);
var lastDayOfMonth = new Date(today.getFullYear(), today.getMonth()+1, 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));
}
else if (pdata['l_expire_type'] == '2') {
//var today = new Date();
var today = new Date($('#mod_date').val());
var lastDayOfMonth = new Date(today.getFullYear(), today.getMonth()+1);
$('#expire_date').html(lastDayOfMonth.getFullYear() + '-' + ('0' + (lastDayOfMonth.getMonth()+1)).slice(-2) + '-' + ('0' + today.getDate()).slice(-2));
$('#mod_expire_date').val(lastDayOfMonth.getFullYear() + '-' + ('0' + (lastDayOfMonth.getMonth()+1)).slice(-2) + '-' + ('0' + today.getDate()).slice(-2));
}
else if (pdata['l_expire_type'] == '3') {
$('#expire_date').html(pdata['l_expire_date']);
$('#mod_expire_date').val(pdata['l_expire_date']);
}
}
});