Using html5 "date" input not working


#1

Getting started with the form inputs, I’ve set up a date input element according to the documentation. Looks good in the browser but in the iOS emulator it doesn’t show any data picker.

Do I need to install any extra plugins to have this work on iOS?


#2

Can you post some code of what you have? Just tried this on my simulator and it works fine.


#3

I’m working off the guides, using this code for the date itself:

<label class="item item-input">
  <span class="input-label">{{item.description}}</span>
  <input type="date" ng-model="item.value">
</label>

The context of the code, is within an ng-repeat:

<ion-view title="{{data.formType}}">
  <ion-content>
    <ul class="list">
      <h2>{{data.organisation}} squad</h2>
      <span ng-repeat="item in data.formData">
        <span ng-switch on="item.input">

          <!-- date -->
          <span ng-switch-when="date">
            <label class="item item-input">
              <span class="input-label">{{item.description}}</span>
              <input type="date" ng-model="item.value">
            </label>
            <br>
          </span>
      ...

In browser looks like this:

On the emulator, like this:

(No date selector is showing at the bottom of the screen)

Any tips appreciated!


#4

Did you figure this out? I’m having the same issue.

Works fine in Chrome/MacOS, but input[date] and input[time] does nothing in the iOS 8 emulator. (Havent tried on a real device yet)

EDIT
I figured it out. If a hardware keyboard is simulated attached, then the input date/time picker does not show on focus. If no hardware keyboard is attached, then it shows. I wonder if it might apply to real devices as well?


#5

Also…

It works fine in the Android emulator.


#6

Good find! Thanks for that. I’m not sure how this affects things on the device. Really helps testing in the simulator though.


#7

Thanks.

I was about to create an issue for it, but it seems to been an iOS 8 bug.
https://bugzilla.xamarin.com/show_bug.cgi?id=22942

I’m wondering how a bug like this makes it all the way through at Apple. Would never have happened in Job’s days. :stuck_out_tongue: