I am trying to create a date/time picker in jade/pug similar to the first example at this link: https://eonasdan.github.io/bootstrap-datetimepicker/. I am useing Node/express js server-side. When I click on the glyphicon-calendar icon the calendar does not appear. I have installed the following package: npm i bootstrap-datetimepicker-npm
So far I have tried the following code :
block console_content
.sensor-page(ng-controller="ambientCtrl")
h1 Sensors
// Date-Time Widget
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.glyphicon.glyphicon-calendar
script(type="text/javascript").
$( document ).ready(function () {$('#datetimepicker1').datetimepicker()});
// Sensor Checkbox Widget
p {{selection}}
label(ng-repeat='sensorName in sensors')
input(type='checkbox', name='selectedSenors[]', value='{{sensorName}}', ng-checked='selection.indexOf(sensorName) > -1', ng-click='toggleSelection(sensorName)')
| {{sensorName}}
button(ng-click="changeSensors()") Show
canvas(id="myChart")
h1 Sensor
p Info about sensors here
script(src='https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.3/Chart.min.js')
link(rel='stylesheet', href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css')
link(rel='stylesheet', href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css')
link(rel='stylesheet', href='https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/css/bootstrap-datetimepicker.min.css')
script(src='https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.min.js')
script(src='https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js')
script(src='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js')
script(src='https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/js/bootstrap-datetimepicker.min.js')
However, this is throwing an error. I have two questions:
What is wrong with the above code and how can I edit it to mimic the code at the above link.
How can I save the selected date time in javascript and convert it to a Unix timestamp?