Search Posts

Category: datetime

how to implement a simple datetime picker in angular 5?

I’m trying to make a datetime picker in Angular 5 but I’m having issues : <script src=”https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js”></script> <script> angular.module(‘dateInputExample’, []) .controller(‘DateController’, [‘$scope’, function($scope) { $scope.example = { value: new Date(2013, 9, 22) }; }]); </script> <form name=”myForm” ng-controller=”DateController as dateCtrl”> <label for=”exampleInput”>Pick a date in 2013:</label> <input type=”date” id=”exampleInput” name=”input” ng-model=”example.value” placeholder=”yyyy-MM-dd” min=”2013-01-01″ max=”2013-12-31″ required /> <div role=”alert”> <span class=”error” ng-show=”myForm.input.$error.required”> Required!</span> <span class=”error” ng-show=”myForm.input.$error.date”> Not a valid date!</span> </div> <var>value = {{example.value | date: […]

What is the most effective way to copy time (hh, mm) from one datetime to another?

I’m trying to write a calendar with timepicker, so that when you change the date, the time stays the same. Both fields (calendar and time) in html use the same variable (vm.inputDate) and I don’t want to change that. Right now I have this function, that triggers on date change: vm.keepTimeUnchanged = function(changedDateTime, oldDateTime) { var hours = oldDateTime.getHours(); var minutes = oldDateTime.getMinutes(); if (!moment(vm.inputDate).isSame((changedDateTime), ‘day’)) { vm.inputDate = changedDateTime; vm.inputDate.setHours(hours, minutes); } return vm.inputDate; […]

Datetime-local not working with firebase-database

I’m trying to insert 4 values into my firebase-database (Equipment, Type, start of downtime and end of downtime). The start and end of downtime values are in datetime-local. When I try inserting the values it only makes nodes for the first 2 values being equipment and type. I don’t know why its not inserting the datetime-local values. MY HTML <div class=”row”> <div class=”col-xs-12″> <div class=”form-group col-xs-6 col-xs-offset-3″ id=”equipList”> <label for=”selectequ”>Select Equipment</label> <select class=”form-control” id=”selectequ” data-ng-model=”equipment” […]