After much googling I think I've added iPhone type="date" support. I had to
make a few assumptions to get it to work.

1. The format for type="date" support is yyyy-mm-dd. This is what the
iPhone appears to use and seems a reasonable choice.
2. The best test I could find to indicate native support is

*var* input = document.createElement('input');

input.setAttribute('type', 'date');

input.value = 'testing';


If the type is date and the value is not testing I'm assuming native date
support.


What I ended up doing was adding a hidden element to support native date
pickers. If I think there is support I hide the real one and turn the
hidden one into a date. On a form submit I copy the data into the real
element. This way I can support both date formats. It seems to work on my
iPhone but that's not a large sample.


There is still work to be done but I think I should be able to meet all
the requirements I've seen so far.





On Thu, Oct 3, 2013 at 9:15 PM, Barry Books <trs...@gmail.com> wrote:

> Unfortunately modernizer does not really support that. From the docs
>
> Modernizr cannot detect that date inputs create a datepicker,
>
> It is possible to detect if a browser support type="date" but that does
> not mean it has a datepicker. I suspect I'm going to add an option to give
> it a try.
>
>
> On Thu, Oct 3, 2013 at 8:12 PM, Geoff Callender <
> geoff.callender.jumpst...@gmail.com> wrote:
>
>> Sounds good, Barry.
>>
>> You mentioned earlier that you were "planing on using modernizr to detect
>> if type="date" is supported. " so that browsers with good HTML5 date
>> support (eg. iOS Safari, Chrome) are left alone. How did that go?
>>
>>
>> On 3 October 2013 12:08, Barry Books <trs...@gmail.com> wrote:
>>
>> > I've uploaded the initial version to github
>> >
>> > https://github.com/trsvax/tapestry-datepicker
>> >
>> > I think I'm going to make this standalone project that only contains the
>> > datepicker. This will make it easier for other project to just include
>> it.
>> > Currently to use it you will have to download and build it.  Here is an
>> > example usage
>> >
>> > <t:form>
>> >     <t:textfield value="date" t:mixins="datefield/JQueryDatePicker"
>> > data-duration="slow"/>
>> >     <input type="submit"/>
>> >   </t:form>
>> >
>> >
>> > All that's required is the input type be a date which causes Tapestry to
>> > use a Date Translator to convert the data to/from a string. This also
>> > creates the client side validation. The mixin adds the client side
>> > interface. In this case the JQuery UI calendar.
>> >
>> > If you prefer you can create your own component and override the
>> Tapestry
>> > one.
>> >
>> > public class DateField extends TextField {
>> >
>> >     @Mixin
>> >     private JQueryDatePIcker mixin;
>> >
>> > }
>> >
>> > Questions, commets etc are welcome
>> >
>> > Barry
>> >
>>
>
>

Reply via email to