下载datepicker这个插件
解压文件放到public/JavaScripts的目录下
加载这个插件
<!--
<script src="/javascripts/datepicker/WdatePicker.js" type="text/javascript"></script>
-->
<%= javascript_include_tag 'datepicker/WdatePicker' %>
调用
<%= text_field_tag "start_time",params[:start_time],:class => 'Wdate', :readonly => true, :onFocus => "WdatePicker({qsEnabled:false,onpicked:function(){$dp.$('end_time').focus();},maxDate:\'#F{$dp.$D(\\'end_time\\')}\'})"%>
~
<%= text_field_tag "end_time",params[:end_time], :class => 'Wdate', :readonly => true, :onFocus => "WdatePicker({qsEnabled:false,minDate:'#F{$dp.$D(\\'start_time\\')}'})"%>
:onFocus => "WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',qsEnabled:false})"
:onFocus => "WdatePicker({dateFmt:'yyyy-MM-dd',qsEnabled:false})"