2

My input field as per below-

<input type="text" maxlength="8" placeholder="" class="time-icn form-control ui-timepicker-input valid" name="ReminderTime" id="ReminderTime" class="ReminderTime" value="" autocomplete="off">

Add time picker as per below

$("#ReminderTime").timepicker({
  "showDuration": true,
  "timeFormat": "g:i A",
  "step": 15,
  "forceRoundTime": true,
  "maxTime": "11:45pm",
  "className": "timepicker-width",
  "scrollDefault": "now",
});

What exactly I do?

Pedram
  • 15,766
  • 10
  • 44
  • 73
Priyanka Khade
  • 450
  • 4
  • 18

1 Answers1

0

Get current hour with date.getHours() and minute date.getMinutes() then set it for minTime, I removed maxTime for selecting remains time of today, Also instead of step, use interval and your timeFormat was wrong.

var date = new Date();
var hour = date.getHours();
var minute = date.getMinutes();

$("#ReminderTime").timepicker({
  "showDuration": true,
  "interval": 15,
  "timeFormat": "h:mm p",
  "forceRoundTime": true,
  "minTime": "" + hour + ":" + minute + "",
  "className": "timepicker-width",
  "scrollDefault": "now",
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/timepicker/1.3.5/jquery.timepicker.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/timepicker/1.3.5/jquery.timepicker.min.js"></script>

<input type="text" maxlength="8" placeholder="" class="time-icn form-control ui-timepicker-input valid" name="ReminderTime" id="ReminderTime" class="ReminderTime" value="" autocomplete="off">
Pedram
  • 15,766
  • 10
  • 44
  • 73
  • 1
    If I have date select option as well and I want to change the date, according to that time was appear? – Priyanka Khade Apr 07 '18 at 08:24
  • It depend to which date picker using, if `jQuery UI` again, yes. But should see it on action, but for now, this is answer to your original question, then do it on `date picker` and if you faced with any problem, make a new question. @PriyankaKhade – Pedram Apr 07 '18 at 08:34