Count days backwards depending on year and month??
In my doc I have 7 text fields (Sun, Mon, Tues, Wed, Thurs, Fri, Sat). I use a different field to enter a date. When I enter a end date, I would like to have the 7 text fields to populate with the dates. For example, if I enter 6/18/2016 in the date field, I'd like to have the 7 text fields to populate like this, Sun would show 12, Mon would show 13, Tues would show 14, Wed would show 15, Thurs would show 16, Fri would show 17 and Sat would show 18. I say to count the days backwards is because I enter the week date end (always a Sat).
What I'm running into is the month prior at times will have 30 days, some months have 31 (and of course leap year). So, for example, if I choose July 2, 2016 the days should come back like this, Sun should show 26, Mon should show 27, Tues should show 28, Wed should show 29, Thurs should show 30, Fri should show 01, Sat should show July 02.
How can I do this correctly? I need a smart javascript to do it. Can someone please help me out with an example? Thanks.
