Closed Ibr4him closed 6 years ago
I am trying to calculate the end time of an appointmnent. I am using pickatime and pickadate by amsul and I combined the the two values to one.
$(document).ready(function(){ var datepicker = $('#date').pickadate({ container: '#outlet', onSet: function(item) { if ( 'select' in item ) setTimeout( timepicker.open, 0 ) } }).pickadate('picker') var timepicker = $('#time').pickatime({ container: '#outlet', onRender: function() { $('<button>back to date</button>'). on('click', function() { timepicker.close() datepicker.open() }).prependTo( this.$root.find('.picker__box') ) }, onSet: function(item) { if ( 'select' in item ) setTimeout( function() { $datetime. off('focus'). val( datepicker.get() + ' ' + timepicker.get() ). focus(). on('focus', datepicker.open) }, 0 ) } }).pickatime('picker') var $datetime = $('#datetime'). on('focus', datepicker.open). on('click', function(event) { event.stopPropagation(); datepicker.open() })
What I am tryig to do is adding the duration time to the date and time was picked for the end date. I tried to use getHours andsetHours but It is not working.
getHours
setHours
var sart_time = $('#datetime').val() I need to do somting like this
var sart_time = $('#datetime').val()
var end_time = star_time+duration
i used moment to get what i needed
I am trying to calculate the end time of an appointmnent. I am using pickatime and pickadate by amsul and I combined the the two values to one.
What I am tryig to do is adding the duration time to the date and time was picked for the end date. I tried to use
getHours
andsetHours
but It is not working.var sart_time = $('#datetime').val()
I need to do somting like thisvar end_time = star_time+duration