I am implementing a real Estate application and I need to EXACTLY check the date difference between two dates.
I will prefer for this a javascript
jquery
approach, but any other solution will be welcome.
My goal is to not allow users to enter dates where the difference is EXACTLY bigger than 2 (or 5) years.
I have tried, along with many others, this solution: How to get the months between 2 dates
Unfortunately, this is not what I really need.
When I do: The rent will start at 01-01-2017 And will end at 31-12-2018 I will get 24 months (exactly rented for 2 years), which is correct for my purpose.
But if I try: The rent will start at 01-01-2017 And will end at 01-01-2019 I will still get 24 months (but it is rented for 2 years and 1 day), which is not correct for my purpose.
Due to the law regulations in my country (Netherlands) there is for the contracts a big difference between the two above mentioned situations.
I will appreciate any help from your side.