Search Posts

Category: datetime

Angular JS Json Datetime filter use from input

this is my filter function(from json date convert): app.filter(“mydate”, function () { var re = //Date(([0-9]*))//; return function (x) { var m = x.match(re); if (m) return new Date(parseInt(m[1])); else return null; }; }); no problem if I use it here: {{k.StartDate | mydate | date: ‘yyyy-MM-dd HH:mm’}} I want to use this filter in input , but I’m getting this error: error I use the filter like this <input class=”w-100″ datetime=”yyyy-MM-dd” ng-model=”ApplyToProgress.CurrentWork.StartDate | mydate […]

Compare date with min and max value not working

I trying to compare date to in min value and max value and something going wrong there. var dueDate = moment().add(10, ‘years’).format(‘DD-MM-YYYY’); var minDate = moment().add(-10, ‘years’).format(‘DD-MM-YYYY’); var checkValidDate = function(date) { if (Date.parse(date) > minDate || Date.parse(date) < dueDate) return date; return null; and I always getting null result example Thanks! Source: AngularJS

time diffrence in double digit

i want to display TravelTimeHoursDiff and TravelTimeMinutesDiff in double digit now my time is shown as 7:0 i want to display like 07:00 if ($scope.DispatchStatus.ArrivalTime != undefined){ var today = $rootScope.getSysDate().split(” “); var timeArrival = new Date(today[0] + ‘ ‘ + $scope.DispatchStatus.ArrivalTime); var TravelTime = new Date(today[0] + ‘ ‘ + $scope.Route.TravelTime); var timeArrivalHours = timeArrival.getHours(); var TravelTimeHoursDiff = timeArrivalHours – TravelTime.getHours() ; var TravelTimeMinutesDiff = (timeArrival.getMinutes() – TravelTime.getMinutes()); if(TravelTimeHoursDiff < 0 || (TravelTimeHoursDiff <= […]

How to pass DateTime from Angular JS to HTTP GET WEB API

how to How to pass DateTime from Angular JS to HTTP GET WEB API I have Date Field and Time Field in HTML. I want to pass Datetime from Angular JS to WEB API in HTTP GET Request but I am unable to do so. HTML <label>Appointment Start Date</label> <p class=”input-group”> <input type=”text” class=”form-control” uib-datepicker-popup=”dd.MM.yyyy” ng-model=”empappt.appstart” is-open=”popup1.opened” show-button-bar=”false” /> <span class=”input-group-btn”> <button type=”button” class=”btn btn-default” ng-click=”open1()”><i class=”glyphicon glyphicon-calendar”></i></button> </span> </p> <label>Appointment Start Time</label> <input type=”time” […]

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” […]