Datetime picker widget?

Hi all,

I have a thermostat where I can set a holiday/party mode by sending a string containing the starting and ending time to an item. To select the starting and ending time a datetime picker would be nice. I am using OH2.

  • is there any custom widget implementing similar functionality?
  • if not, is there a way to add existing angular code so the HABpanel will automatically include the needed js files, or do I have to change the HAPpanel package, add the files, update web/index.html and create and install the updated jar?

Many thanks

1 Like

You might want to take a look at ui-boostrap’s datepicker and use ng-init to define the datepicker-options.

Thanks for your hint. Right now I am experimenting with angular’s input[datetime], but I am failing at the requirement to initialize the value to new Date() necessary to start with the current date, which is something that the ng-init can’t do. Let’s see whether this one can do without it.
Looks like the inability to define controllers is a major drawback…

Hey Guys,
I just started to go a bit deeper with OH2 and are still struggeling with AngularJS.
I wanted to create a custom widget for picking up a time but the JS behind that isnt working.

First I installed the ui.bootstrap in /conf/htm/node_modules/angular-ui-bootstrap and made a “mycontroller.js” in /conf/html with:

    .module('app.widget.timepicker', ['ui.bootstrap', 'ui.bootstrap.timepicker'])

Then i created a widget with:

<div oc-lazy-load="['/static/mycontroller.js', '/static/timepicker/timepicker.js', '/static/node_modules/angular-ui-bootstrap/src/timepicker/timepicker.js', '/static/node_modules/angular-ui-bootstrap/src/timepicker/timepicker.css']" >

<div  ng-controller="timepicker">

  <div uib-timepicker ng-model="mytime" ng-change="changed()" hour-step="hstep" minute-step="mstep" show-meridian="ismeridian"></div>

  <pre class="alert alert-info">Time is: {{mytime | date:'shortTime' }}</pre>


Would be so glad if i can get some help with this or some tips for debugging this :slightly_smiling_face:
Many thanks