owenmead / Pikaday

A refreshing JavaScript Datepicker — lightweight, no dependencies, modular CSS
Other
153 stars 73 forks source link

how to disable time collection for fields that are Date only #53

Closed memoht closed 7 years ago

memoht commented 7 years ago

I replaced my standard Pikaday with this fork and I like the implementation, but I have several fields in forms that are Date only, not DateTime. I tried to implement the options for turning off Hour and Minutes in specific fields, but they are still showing up everywhere. Is it not possible to selectively disable the Hour and Time functions?

vpatil commented 7 years ago

@memoht Setting the showTime prop to false hid the time picker for me.

memoht commented 7 years ago

@vpatil Do you perhaps have an example? Maybe my syntax isn't correct. Here is an example from from a .coffee file in my app.

  picker = new Pikaday(field: document.getElementById('task_due_date'),
    firstDay: 1, disableWeekends: true, showTime: false)

With this syntax, the time is still showing. Any help is appreciated.

memoht commented 7 years ago

Amended. I tried the alternate syntax for jQuery and it worked. Also tried above with 2nd line not indented and it worked. Indentation counts. Curses.

  picker = new Pikaday(field: $("#task_due_date")[0],
  firstDay: 1, disableWeekends: true, showTime: true)

Thanks. I will proceed with this.