Generic Date Calculation
Hi All,
I am working on a project where I am creating records depending on the date range chosen, Option Chosen and the pattern chosen.
By pattern I mean -> Daily,Weekly, Monthly, Yearly.
Date Range -> Start Date & End Date
Option Chosen -> Any numeric No. ex. 1,2,3,4
There are javascript validations to check the validity of the Option & Pattern against the Date Range.
How it Works
------------
1. I have chosen 'Monthly' Option
2. I have chosen '2' as Option which means every 2 Months
3. Start Date = 10/04/2008 End Date = 11/05/2008
This should give me a validation message:
"Date Range does not match Pattern and Option Chosen."
Reason: Since I have chosen for every 2 months means date range should be >= 2 * No. of days in the 2 months. Since date range between 10/04/2008 - 11/05/2008 is only 30 days which is less than 60 days no records would be created.
I need a generic javascript function where I can pass the Pattern & Option & Start Date as parameters and the function would return me the total days as numeric value. This I can use to compare with the total gap in days between the Date range Chosen.
Kindly Help !!!
|