2019-03-06 17:34:04 +08:00
|
|
|
<div class="datetime-picker-container" id="<%= id %>">
|
|
|
|
<% if label %>
|
|
|
|
<label class="control-label required" for="calendar-<%= id %>"><%= label %></label>
|
|
|
|
<% end %>
|
2019-03-27 21:39:29 +08:00
|
|
|
<input type="datetime" class="form-control" name="calendar[<%= id %>]" id="calendar-<%= id %>" readonly="" data-ts="" placeholder="<%= placeholder %>" />
|
2019-03-06 17:34:04 +08:00
|
|
|
<%
|
|
|
|
js_format = I18n.backend.date_format.dup
|
|
|
|
js_format.gsub!(/%-d/, 'D')
|
|
|
|
js_format.gsub!(/%d/, 'DD')
|
|
|
|
js_format.gsub!(/%-m/, 'M')
|
|
|
|
js_format.gsub!(/%m/, 'MM')
|
|
|
|
js_format.gsub!(/%b/, 'MMM')
|
|
|
|
js_format.gsub!(/%B/, 'MMMM')
|
|
|
|
js_format.gsub!('%Y', 'YYYY')
|
|
|
|
%>
|
|
|
|
<script type="text/javascript">
|
|
|
|
$(function () {
|
|
|
|
var dt = $('#calendar-<%= id %>');
|
2019-03-26 00:35:54 +08:00
|
|
|
dt.datetimepicker({ useCurrent: <%= use_current %>, ignoreReadonly: true, locale: '<%= I18n.locale %>', format: '<%= js_format %>' });
|
|
|
|
$('#calendar-<%= id %>').data('DateTimePicker').date(null);
|
2019-03-06 17:34:04 +08:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
</div>
|