Arushi Arushi - 1 year ago 58
JSON Question

time picker returning null value if start and end time both same

<input type="text" id="from" class="form-control timepicker timepicker-no-seconds" name="start_activity">

<input type="text" id="to" class="form-control timepicker timepicker-no-seconds" name="end_activity">

In script for both is :
$('#from').timepicker();
$('#to').timepicker();


i have two time picker in a form but when i am saving start time and end time as same then like start is 4pm and end also 4pm then it returning me the null value in end time when i am getting the value from the database.

Answer Source

You could use Array.filter:

...
events: <?= $response ?>.filter(function(x) { return x.status === "1";}),
...                    

If you do it this way (or the way you have it) please ensure that the $response variable always results in an array, even if empty, or you will have headaches.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download