how to create a datetime picker in serviceportal?

Sandeep132
Kilo Sage

Hi All,

Did anyone tried creating a datetime picker in ServicePortal Widgets. I tried checking the date time field available in the forms widget but the code for date time field on it is hidden and have no access to it. I tried the jquery code which is gives the exact date time field as available in the forms widget but was unable to convert it into angular code to get the value of date selected. Below is the jquery code i am using.

<div class="container">
  <div class="row">
  <div class='col-sm-6'>
  <div class="form-group">
  <div class='input-group date' id='datetimepicker1'>
  <input type='text' class="form-control" />
  <span class="input-group-addon">
  <span class="glyphicon glyphicon-calendar"></span>
  </span>
  </div>
  </div>
  </div>
  <script>
  $(function () {
  $('#datetimepicker1').datetimepicker();
  });
  </script>
  </div>
</div>

Can anyone let me know how can i use this code for datetime in service portal.

Thanks

2 REPLIES 2

Shishir Srivast
Mega Sage

Ximizu
Mega Guru

Solution

Use this directive snDatePicker and add the options sn-include-time="true"

<sp-date-picker ng-model="your.model.value" sn-change="" sn-include-time="true" ></sp-date-picker>