The following is my Javascript (without jQuery) solution for From and To datepickers using Pikaday. It works in Chrome and Firefox, but it does not work in Chrome-Android.
var nowDT = new Date(); var nowDTStr = nowDT.toShortDate(); var sin = document.createElement('input'); sin.setAttribute('type', 'text'); sin.setAttribute('id', this.id + "_cp_sin"); sin.style.width = '20%'; sin.style.cssFloat = 'left'; this.controlPanel.appendChild(sin); this.sinPika = new Pikaday({ field: sin, firstDay: 1, minDate: new Date('2001-01-01'), maxDate: new Date(nowDTStr), yearRange: [2001, nowDT.getFullYear()] }); this.sinPika.setDate(nowDTStr); var ein = document.createElement('input'); ein.setAttribute('type', 'text'); ein.setAttribute('id', this.id + "_cp_ein"); ein.style.width = '20%'; ein.style.cssFloat = 'right'; this.controlPanel.appendChild(ein); this.einPika = new Pikaday({ field: ein, firstDay: 1, minDate: new Date('2001-01-01'), maxDate: new Date(nowDTStr), yearRange: [2001, nowDT.getFullYear()] }); this.einPika.setDate(nowDTStr);
Since I have sinPika and einPika objects added as members of my class, they are available elsewhere in my class in other ways, where Pika objects are used to get the dates set by users. The only thing is that this solution does not work in Chrome-Android for me. Can someone try and let me know what you find? Thanks!
Edit
I found the problem why Picadeus didn't work on the chrome android for me. The reason is that pikaday.js ( https://github.com/dbushell/Pikaday/blob/master/pikaday.js ) is different from the one here http://dbushell.imtqy.com/Pikaday/ , because the difference consists in attaching muscle events. Pikaday.js on github is attached as follows:
addEvent(self.el, 'ontouchend' in document ? 'ontouchend' : 'mousedown', self._onMouseDown, true);
(I think Javascript defines touchend not ontouchend , maybe for that very reason Pikaday.js from github repo does not work.)
And the one on dbushell.imtqy.com/Pikaday is attached as follows:
addEvent(self.el, 'mousedown', self._onMouseDown, true);
Using the script from http://dbushell.imtqy.com/Pikaday/ works on a chrome android, but not in the git repository.