引入jquery ui的cdn:

     <script src="https://code.jquery.com/jquery-3.6.0.js"></script>
     <script src="https://code.jquery.com/ui/1.13.2/jquery-ui.js"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.13.2/themes/base/jquery-ui.min.css" integrity="sha512-ELV+xyi8IhEApPS/pSj66+Jiw+sOT1Mqkzlh8ExXihe4zfqbWkxPRi8wptXIO9g73FSlhmquFlUOuMSoXz5IRw==" crossorigin="anonymous" referrerpolicy="no-referrer" />

然后在layout页面增加:

<script>
   $( function() {
      $( "#datepicker" ).datepicker({
         dateFormat: "yy-mm-dd",
         dayNamesMin: [  "", "", "", "", "", "", "" ],
         monthNames: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月" ]
     });
   } );
 </script>

在对应的视图页面就可以使用:

 <%= text_field_tag :start_at_day, params[:start_at_day], id: 'datepicker', placeholder: '开始日期时间', class: 'select_date', style: 'margin-top: 20px; margin-right: 20px;' %>