By default kendotimepicker have a time interval of 30 min,but i want to reduce it to 1 min.What should i do in this line to set time interval to 1 min
var timepicker = $("#timepicker").data("kendoTimePicker");
This isn't really an angular question since you're using jQuery.
<input id="timepicker" />
<script>
$("#timepicker").kendoTimePicker({
interval: 1
});
</script>
As per:
http://docs.telerik.com/kendo-ui/api/javascript/ui/timepicker
Related
i am trying to create a script that can update the current time automatically in the datetime-local input without having to click and selecting the current time. this is the code that i am working with to have the input display the current date and time, but i also want it to update the current time when the time changes.
then i hope to submit the datetime-local value to the database using PHP (i got this section covered)
and i was hoping if it's possible to delete the date and time selection button in the input and how can i show the seconds, but have the seconds running accurately with current time
thank you all.
var now = new Date();
now.setMinutes(now.getMinutes() - now.getTimezoneOffset());
document.getElementById('dt').value = now.toISOString().slice(0,16);
<input id="dt" type="datetime-local" />
I think you can set an interval every second for this.
functionName(); //First execution
setInterval(functionName, 1000); //Check every second
function functionName(){
var now = new Date();
now.setMinutes(now.getMinutes() - now.getTimezoneOffset());
document.getElementById('dt').value = now.toISOString().slice(0,16);
}
<input readonly id="dt" type="datetime-local" />
Of course you will need to "Stop" this interval when the user clicks on the input, or the date can never be changed
EDIT: For avoid the user to change the date, just add readonly attribute to the input tag.
Using Jquery Timepicker . Is it possible to do so, that when I select a date, then time is automatically set to 23.59, but if I change the time manually then it keeps the time value?
I dont want the datetime showing until i select a date or time. But currently all the solutions that I have found are about setting a default value that you can see when the element is loaded.
<input size="15" class="timePicker" name="name" id="id" style="width: 100%" />
jQuery('.timePicker').datetimepicker({
dateFormat: 'dd.mm.yy'
});
SOLUTION
Apparently it turns out, that in the timepicker sourcecode options hour and minute are ignored and not used. Solution for that would be to open up the timepicker.js, find the _newInst function and then either change the corresponding lines, or you could just override the prototype method with a method that has the required fixes.
So simple just change the default timepicker values before calling the time picker as below :
$.timepicker._defaults.hour = 23;
$.timepicker._defaults.minute = 59;
var jq = jQuery('.timePicker').datetimepicker({
dateFormat: 'dd.mm.yy'
});
see this working Fiddle .
I am using the "timer initialized with some predefined end time" found here: http://siddii.github.io/angular-timer.
I got it working on my site, however, I want to remove a DOM element once the timer hits 0. Below is the code that I have:
<timer end-time="1451628000000">{{days}} days, {{hours}} hours, {{minutes}} minutes, {{seconds}} seconds.<div ng-if="milleseconds > 0">The countdown has not finished yet!</div></timer>
I want the above div to disappear once the milleseconds become 0, because that means the countdown has finished.
What am I doing wrong?
From the documentation, it looks like milliseconds is represented as millis, not milliseconds.
I'm using the following code to create a timepicker (source: http://mgcrea.github.io/angular-strap/#/datepicker#timepickers). But I can't initialize the time. It keeps initializing local time while I want another. What am I doing wrong?
html
<input id="txtContrStartTimeTime" name="txtStartTimeTime" type="text"
class="form-control"
ng-model="time"
bs-timepicker data-show-meridian="false" data-minute-step="1"
>
JS
$scope.time = new Date(546541685565); //somewhere in 1989
console.log("time first", $scope.time);
I had to disable a default time being set and change $scope.time to "hh:mm" format.
data-default-time="false"
Try:
$scope.time = new Date(new Date(546541685565).setMinutes(0));
As done in the plunkr of the widget:
http://plnkr.co/edit/?p=preview
EDIT:
Actually it should work without setMiutes(0). Are you sure, you're setting the right model?
When I use JavaScript to set the value of an HTML5 "time" object, like this:
document.getElementById("settime").value = "13:24:59";
It will show a time control with "13:24:59" on it, and I can change everything. But if I do this:
document.getElementById("settime").value = "13:25:00";
It hides the seconds, showing just "13:25" with no seconds. How do I force the "00" seconds to appear in this case?
(This is in Google Chrome, by the way.)
Set the step attribute.
Ex: <input id="settime" type="time" step="1" />
document.getElementById("settime").value = "13:24:00";
<input id="settime" type="time" step="1" />
A note about the step attribute:
The step attribute can be used with a numerical input value to dictate how granular the values you can input are. For example, you might want users to enter a particular time, but only in 30 minute increments. In this case, we can use the step attribute, keeping in mind that for time inputs the value of the attribute is in seconds. For example, a 30 minute increment would have a step value of 1800. <input type="time" step="1800">
Step=1 doesn't work on chrome/iOS