passing javascript options in HTML

I am using ruby gem bootstrap-datepicker-rails in my Rails-4 application, to draw a form for taking from_date and till_date as input as following. The beauty of this code is no javascript is needed as that in encoded in this gem’s code.

<div class=" input-daterange" id="datepicker" data-provide='datepicker'>
  <label>From Date</label>
  <input type="text" class="form-control" name="from_date" id="from_date">

  <label>Till Date</label>
  <input type="text" class="form-control" name="till_date" id="till_date">

By default it takes format as “mm/dd/yyyy”, I want to change it to “yyyy-dd-mm”, Is it possible to do this by passing this in html options only and not using any javascript for it. I tried following and some other permutations of these, but of-course they didn’t work.

<div class=" input-daterange" id="datepicker" data-provide='datepicker' options='format:"yyyy-mm-dd"'>

<div class="row input-daterange" id="datepicker" data-provide='datepicker' format="yyyy-mm-dd" >

Please let me know if this is possible to do and how.

Source: ruby

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.