I am again here with a big task in my project which I am unable to do.
I am having 3 text fields and 3 list boxes;
Two text fields will contain values of two different dates (which I am getting using the datetimepicker.js library file) one for start date and another for end date.
Two list boxes which have time duration of 24hours with an interval of 5 minutes each as its options.. One list box for start time and another for end time.
3rd list box which has its options as: minutes, hours, days, months and years.
I have 3rd text field, "time allotted" which takes a numeric value as its input.
Now the problem is when I select dates from the first two text fields: start date and end date, I have to calculate the difference of the dates and display the difference in the "time allotted" text box and make "days" selected from the list box. Similarly if I select same date from the first two text fields and select time from the list boxes: start time and end time, I need to calculate difference of the both the times and display the difference in the "time allotted" text box and make "minutes" selected. And same is the case with months and years. Can anyone help me how to achieve this task.
I wrote a loop to generate values in the start time and end time list boxes: