0

The following script works on all browsers and devices, but since the release of iOS 5 on the iphone, it no longer works.

The following code calculates dates into inputs so I can send them in a form. However, now the dates show up as NaN.

Cant see why.

        function makeUpDates(){
            // concantenate values to date_start and date_end hidden inputs
            var dateString = document.getElementById('date').value,
            date = new Date(dateString);

            document.getElementById('date_start').value = date.getFullYear() + '-' + (date.getMonth()+1) + '-' + ("0" + date.getDate()).slice(-2);

            var numDays = document.getElementById('slider').value;
            date.setDate(date.getDate() + parseInt(numDays));   

            var dateEnd = date.getFullYear() + '-' + (date.getMonth()+1) + '-' + ("0" + date.getDate()).slice(-2);
            document.getElementById('date_end').value = dateEnd;
        }
nickytonline
  • 6,855
  • 6
  • 42
  • 76
Keith Power
  • 13,891
  • 22
  • 66
  • 135

1 Answers1

1

The issue was I was missing the override code on the inputs. This was never an issue with other browsers, just iso5 on the iphone

<script>
 //reset type=date inputs to text
 $( document ).bind( "mobileinit", function(){
 $.mobile.page.prototype.options.degradeInputs.date = true;
 });    
</script>   
Keith Power
  • 13,891
  • 22
  • 66
  • 135
  • Have you found any other weird, related workarounds on iOS 5? E.g. I'm having [this problem here](http://stackoverflow.com/questions/9210015/jquery-ajax-stopped-working-with-ios-5-0-1) – Lukas Eder Feb 09 '12 at 11:28