I'm currently having a problem. I have two date-time fields a Start Date and an End Date. If i pick a date on the Start date for example October 2,2016 and pick a date on the End date October 1,2016 an alert dialog box should appear that the end date is earlier than the Start Date. How do i validate this via script? Sorry i am still very new to programming.
Asked
Active
Viewed 40 times
0
-
3Can you please show some code you have tried – Azeez Kallayi Oct 25 '16 at 06:58
-
possible duplicate http://stackoverflow.com/questions/833997/validate-that-end-date-is-greater-than-start-date-with-jquery – rajesh Oct 25 '16 at 07:01
-
Checking your link. – Junnel Oct 25 '16 at 07:03
1 Answers
0
try this datetime lib, it has such function http://momentjs.com/docs/#/query/is-after/ it shoud be something like
if (moment(dateBefore).isAfter(dateAfter)) {do somth}

Pasha K
- 357
- 1
- 7