HI
I need some help to finalize my script. This script is always setting up day to 28. If the give date is higher than 28, t. ex 29, 30, 31 - then month is changing (+1) and date is set to 28.
This works great. T. ex if date is 2020-03-03 I got 2020-03-28, and for 2020-03-29 - I got 2020-04-28
Then I need to calculate future date. And I have variable (cCrediTtime2) in months (can be 4, 15 or 60) and I have problem to calculate this new date.
Here is my code. Please help!!
var field = "";
field = record.fields["CreditTime2"];
var currentDate = new Date();
var currentDay = currentDate.getDate() ;
currentDate.setDate(28);
if (currentDay > 28) {
currentDate.setMonth(currentDate.getMonth() + 1);
}
var month = currentDate.getMonth() + 1 + field;
var year = currentDate.getFullYear();
results.html(year + '-' + month + '-' + 28);
[/i]