- Tue May 29, 2018 12:12 am
#814564
Hi all,
I am trying to use Moments.js to calculate a date but am having some (probably fundamental) problems...
I have a Date variable @@requireDate which represents the due date for a piece of work.
I have a floating point variable @@estimatedTimeToDigitise which represents the number of days required to carry out the work.
I have another date variable @@digitisationStartDate which should be calculated by subracting the work effort from the required date. This is executed by a button setStartDate.
I'm using the following code:
All help and suggestion gratefully received.
cheers
Greg
I am trying to use Moments.js to calculate a date but am having some (probably fundamental) problems...
I have a Date variable @@requireDate which represents the due date for a piece of work.
I have a floating point variable @@estimatedTimeToDigitise which represents the number of days required to carry out the work.
I have another date variable @@digitisationStartDate which should be calculated by subracting the work effort from the required date. This is executed by a button setStartDate.
I'm using the following code:
Code: Select all
However, when I enter the values and click the button nothing happens.function setDigiStartDate(){
var requireDate = $('#requireDate').getValue();
var estimatedTimeToDigitise = $('#estimatedTimeToDigitise').getValue();
var digiStartDate= moment(requireDate).subtract(estimatedTimeToDigitise, 'days');
$('#digitisationStartDate').setValue(digiStartDate);
};
$('#setStartdate').click(setDigiStartDate);
All help and suggestion gratefully received.
cheers
Greg