您可以通过自定义插件来实现这一点。
你会想找到timepicker.js
在里面/wp-content/plugins/acf-field-date-time-picker/js/timepicker.js
并更改第21行:
, yearRange: "-100:+100"
到您的首选范围,例如:
, yearRange: "-500:+100"
这会提供一个下拉列表,默认情况下,该下拉列表可以从当前年份向后追溯500年,再向前追溯100年。
或者,您可以这样硬编码特定范围,以满足您的特定需求:
, yearRange: "1500:1699"
当然,如果插件得到更新,这些将被覆盖,但这是对当前问题的快速修复。
默认情况下,整个代码块如下所示:
input.addClass(\'active\').attr("placeholder", (is_timeonly) ? time_format : date_format + \' \' + time_format).datetimepicker({
changeYear: true
, yearRange: "-100:+100"
, changeMonth: true
, timeOnly: is_timeonly
, timeFormat: time_format
, dateFormat: date_format
, showWeek: (input.attr(\'data-show_week_number\') != "true") ? 0 : 1
, ampm: has_ampm
, controlType: input.attr(\'data-picker\')
, timeOnlyTitle: input.attr(\'title\')
, monthNames: timepicker_objectL10n.monthNames
, monthNamesShort: timepicker_objectL10n.monthNamesShort
, dayNames: timepicker_objectL10n.dayNames
, dayNamesShort: timepicker_objectL10n.dayNamesShort
, dayNamesMin: timepicker_objectL10n.dayNamesMin
, firstDay: timepicker_objectL10n.firstDay
});