Javascript experts, question

Got something cool to share with AppGini users? Feel free to post it here!
Post Reply
dragon
Veteran Member
Posts: 44
Joined: 2015-09-29 00:06

Javascript experts, question

Post by dragon » 2015-10-17 17:38

I have a table with a test_date field. Let's call this tableA and field test_date.

On my form, I'm trying to calculate the due_date based on the test_date.

The following code only gives me today's date, but works for that, I need to adapt it for a given number of days. For example, 7 days. So if the test_date was 9/29/2015, I'd get 10/06/2015 for the due_date.

Code: Select all

<input type="date" id="dddd" class="form-control" name="due_date" readonly>

<script>
document.getElementById('dddd').value = new Date().toISOString().substring(0, 10);
</script>
Appgini 5.50, Revision 835. Mac OSX 10.11 running Windows 10 on VMWare.

Ola Yakout
AppGini Intern
Posts: 19
Joined: 2016-02-07 13:24

Re: Javascript experts, question

Post by Ola Yakout » 2016-02-09 20:56

first you can select date then split using "-" to get parts of the date like day=parts[2] then add 7 days to day part finally rebuild the date using new Date( month,day,year )

Post Reply