function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
TykeTyke 

How to Calculate the Term between 2 given Dates

I have a requirement to be able to add a new contract to a set of existing contracts so that the new contract has a start date of today and an end date which is the same as the end date of the existing contracts.
In order to do this i need to create a new contract with the start date of today and a duration (Term) value which will ensure that Salesforce calculates the end date as the same as the existing contracts.
So what i need is a MonthDiff function which given 2 dates will return a duration such as 4.823 months.
Does anyone have some javascript to do this?
TykeTyke
I have just noticed that duration can only be entered as an exact number of months, so this functionality is no longer needed.
Thanks.