Is it possible using Forms 10 to take a value from one date field and calculate the 1st day of the following month from that value and populate another field?
Question
Question
Answer
Hi there,
=DATE(IF(MONTH(Date)%12 + 1 = 1, YEAR(Date) + 1, YEAR(Date)), MONTH(Date)%12 + 1, 1) and output to a date field.
Is this what you need?
I have a similar question but don't know how to modify this formula. I'm preparing a timesheet and have the first day of the pay period and want each day after to populate. So I have day 1 (say March 8, 2019, aka PPStart Variable) and want to essentially do, PPStart+1 for March 9, 2019 in one field. Then in another field I want PPStart+2 for March 10, 2019, and so on.
How do I modify the formula to do this?
Oh, nevermind. It was literally as easy as =PPStart+1
Replies
You can use moment.js for this.
I have a sample form with a date field for input (CSS class name inputDate), another date field to display the first day of next month (CSS class name nextDate), and a single line field to display the name of the day that's the first day of next month (CSS class name nextDay). Place the moment.js file into your C:\Program Files\Laserfiche\Laserfiche Forms\Forms\js folder. Then you can use
$(document).ready(function () { $.getScript('http://server/Forms/js/moment.js') $('.inputDate input').on('change', function() { $('.nextDate input').val(moment($(this).val()).add(1,'months').startOf('month').format('M/D/YYYY')); $('.nextDay input').val(moment($(this).val()).add(1,'months').startOf('month').format('dddd')); }); });
First thing that came to my mind was workflow date time calculator, but you mentioned forms. I would recommend Javascript something like this.
http://stackoverflow.com/questions/10931288/how-to-add-subtract-dates-with-javascript