jQWidgets Forums
jQuery UI Widgets › Forums › Editors › DateTimeInput › Time not set when using mobile browser
This topic contains 7 replies, has 2 voices, and was last updated by nab054371 9 years, 9 months ago.
-
Author
-
Hi,
So I am using datetimepicker to capture time input as shown below. It works in almost all cases expect when using a mobile browser. On mobile browser (chrome) it appears that the end user input is ignored and the time resets back to sTime or the current time depending on the if condition taken. Any help would be highly appreciated.
$(“#timepicker”).jqxDateTimeInput({ width: ‘35%’, height: ’28px’, formatString: ‘HH:mm’, showCalendarButton: false});
if((selectedtime != null) && (selectedtime != “”)){
var sTime = ConvertToTime(selectedtime);
$(“#timepicker”).jqxDateTimeInput(‘setDate’, new Date(sTime));
}
else{
$(“#timepicker”).jqxDateTimeInput(‘setDate’, new Date());
}Hi nab054371,
What’s selectedTime?
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comselectedtime (string type) is the input that end user will key into this datetime field. It is null in the beginning. It accounts for the scenario where an error is encountered on the server side and the page has to be displayed back to the end user with the values keyed in by the user. This piece of code works just fine when using desktop based browsers. I am sharing converttotime function below:
function ConvertToTime(stringTime)
{
var date = new Date();
hours = stringTime.substr(0,2);
minutes = stringTime.substr(3,2);
date.setHours(parseInt(hours));
date.setMinutes(parseInt(minutes));return date;
}Your thoughts Peter?
Hi nab054371,
I will need a full example, jsfiddle.net preferably. I can’t test this with the given details.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter,
Here’s the link to jsfiddle:
https://jsfiddle.net/s1fuzq77/
Please note that this feature works on desktop browser. The issue seems to manifest itself on mobile. I am using android mobile for my testing effort.
Regards
Hi nab0504371,
Here’s a sample for getting the time-part: https://jsfiddle.net/jqwidgets/cLs62kk2/ and it shows that the DateTimeInput’s methods work correctly with mobile or not mobile.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comThank you Peter. Did you just add a button to the solution I shared with you? Cause I am not seeing much of a difference between your solution and the non-working solution that I shared with you couple of days ago. The problem is – everytime I try to change the time value, it resets itself to currenttime. So I am not able to update the time value when using it in mobile.
-
AuthorPosts
You must be logged in to reply to this topic.