Pregunta

After clicking the input field that opens the DateTimePicker (we use this one from mobiscroll) our Android HTML5 App crashes with a NumberFormatException at parseInt (which is trying to parse "11.07.1993"). Obviously it should not be parsing the date. Strangely enough, this Bug only happens on Samsung Galaxy S3.

The code that calls the mobiscroller looks like this:

$(function () 
{
    // create a datepicker                  
    $("#ti_gebdat").mobiscroll().date(
    {
        display: 'bottom', 
        dateFormat: 'dd.mm.yy', 
        dateOrder: 'ddmmyy', 
        lang: 'de', 
        onBeforeShow: function (html, inst) 
        {
            inst.setDate(dataclass.gebDat, true, 2);
        }
    }); 
    $("#ti_gebdat").bind('change', function (event) 
    {
        var dt = $.mobiscroll.parseDate('yy-mm-dd',event.target.value,'');                      
        event.target.value = $.mobiscroll.formatDate('dd.mm.yy', dt, '');
        dataclass.setGebDat(dt);
    });                 
    $('#ti_gebdat').scroller('option', {  maxDate: new Date() });
});

The input field looks like this:

<input name="ti_gebdat" id="ti_gebdat" style="text-align: right"
     placeholder="" value="" type="date" readonly>

How can I make it work on Galaxy S3 too?

UPDATE

Also crashes with Galaxy S4.

¿Fue útil?

Solución

The problem was that Samsung Galaxy S3 and S4 do actually support the element input with type="date" and calls its own DatePicker. Since the mobiscroll DatePicker was called too at the same time, it resulted in a crash. Removing date from the input element would solve the problem.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top