在AdministrateRails引擎提供的日期选择器中,星期一是一周中的第一天



我正在学习使用Thoughtbot的Administrate引擎作为管理面板生成器。

为了自定义库默认在表单中使用的日期/时间选择器,我生成了相应的部分,其中包含以下行:

<%= f.text_field field.attribute, data: { type: 'datetime'}  %>

通过编辑这个,我已经能够调整日期格式:

<%= f.text_field field.attribute, data: { type: 'datetime', 'date-format': "DD-MM-YYYY  HH:mm" }  %>

然而,我似乎找不到任何关于如何更改其他设置的文档,例如语言环境,包括一周中的第一天。

我正在查看源代码,它似乎不支持更改一周的第一天,以下是它支持的选项

fe.fn.datetimepicker.defaults = {
    format: !1,
    dayViewHeaderFormat: "MMMM YYYY",
    extraFormats: !1,
    stepping: 1,
    minDate: !1,
    maxDate: !1,
    useCurrent: !0,
    collapse: !0,
    locale: pe.locale(),
    defaultDate: !1,
    disabledDates: !1,
    enabledDates: !1,
    icons: {
        time: "glyphicon glyphicon-time",
        date: "glyphicon glyphicon-calendar",
        up: "glyphicon glyphicon-chevron-up",
        down: "glyphicon glyphicon-chevron-down",
        previous: "glyphicon glyphicon-chevron-left",
        next: "glyphicon glyphicon-chevron-right",
        today: "glyphicon glyphicon-screenshot",
        clear: "glyphicon glyphicon-trash",
        close: "glyphicon glyphicon-remove"
    },
    tooltips: {
        today: "Go to today",
        clear: "Clear selection",
        close: "Close the picker",
        selectMonth: "Select Month",
        prevMonth: "Previous Month",
        nextMonth: "Next Month",
        selectYear: "Select Year",
        prevYear: "Previous Year",
        nextYear: "Next Year",
        selectDecade: "Select Decade",
        prevDecade: "Previous Decade",
        nextDecade: "Next Decade",
        prevCentury: "Previous Century",
        nextCentury: "Next Century"
    },
    useStrict: !1,
    sideBySide: !1,
    daysOfWeekDisabled: !1,
    calendarWeeks: !1,
    viewMode: "days",
    toolbarPlacement: "default",
    showTodayButton: !1,
    showClear: !1,
    showClose: !1,
    widgetPositioning: {
        horizontal: "auto",
        vertical: "auto"
    },
    widgetParent: null,
    ignoreReadonly: !1,
    keepOpen: !1,
    focusOnShow: !0,
    inline: !1,
    keepInvalid: !1,
    datepickerInput: ".datepickerinput",
    keyBinds: {
        up: function(e) {
            if (e) {
                var t = this.date() || pe();
                e.find(".datepicker").is(":visible") ? this.date(t.clone().subtract(7, "d")) : this.date(t.clone().add(this.stepping(), "m"))
            }
        },
        down: function(e) {
            if (e) {
                var t = this.date() || pe();
                e.find(".datepicker").is(":visible") ? this.date(t.clone().add(7, "d")) : this.date(t.clone().subtract(this.stepping(), "m"))
            } else
                this.show()
        },
        "control up": function(e) {
            if (e) {
                var t = this.date() || pe();
                e.find(".datepicker").is(":visible") ? this.date(t.clone().subtract(1, "y")) : this.date(t.clone().add(1, "h"))
            }
        },
        "control down": function(e) {
            if (e) {
                var t = this.date() || pe();
                e.find(".datepicker").is(":visible") ? this.date(t.clone().add(1, "y")) : this.date(t.clone().subtract(1, "h"))
            }
        },
        left: function(e) {
            if (e) {
                var t = this.date() || pe();
                e.find(".datepicker").is(":visible") && this.date(t.clone().subtract(1, "d"))
            }
        },
        right: function(e) {
            if (e) {
                var t = this.date() || pe();
                e.find(".datepicker").is(":visible") && this.date(t.clone().add(1, "d"))
            }
        },
        pageUp: function(e) {
            if (e) {
                var t = this.date() || pe();
                e.find(".datepicker").is(":visible") && this.date(t.clone().subtract(1, "M"))
            }
        },
        pageDown: function(e) {
            if (e) {
                var t = this.date() || pe();
                e.find(".datepicker").is(":visible") && this.date(t.clone().add(1, "M"))
            }
        },
        enter: function() {
            this.hide()
        },
        escape: function() {
            this.hide()
        },
        "control space": function(e) {
            e.find(".timepicker").is(":visible") && e.find('.btn[data-action="togglePeriod"]').click()
        },
        t: function() {
            this.date(pe())
        },
        "delete": function() {
            this.clear()
        }
    },
    debug: !1,
    allowInputToggle: !1,
    disabledTimeIntervals: !1,
    disabledHours: !1,
    enabledHours: !1,
    viewDate: !1
}

对于地方,它似乎接受它们,你可以使用

相关内容

  • 没有找到相关文章

最新更新