0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-25 18:50:27 +01:00

Merge pull request #159 from paviliondev/fix_date_time_display

FIX: pass a fallback format to date picker
Dieser Commit ist enthalten in:
Angus McLeod 2021-11-22 09:24:25 +08:00 committet von GitHub
Commit ce0335b679
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
2 geänderte Dateien mit 5 neuen und 31 gelöschten Zeilen

Datei anzeigen

@ -1,8 +1,5 @@
import DateInput from "discourse/components/date-input"; import DateInput from "discourse/components/date-input";
import loadScript from "discourse/lib/load-script";
import discourseComputed from "discourse-common/utils/decorators"; import discourseComputed from "discourse-common/utils/decorators";
import I18n from "I18n";
/* global Pikaday:true */
export default DateInput.extend({ export default DateInput.extend({
useNativePicker: false, useNativePicker: false,
@ -11,32 +8,9 @@ export default DateInput.extend({
placeholder() { placeholder() {
return this.format; return this.format;
}, },
_opts() {
_loadPikadayPicker(container) { return {
return loadScript("/javascripts/pikaday.js").then(() => { format: this.format || "LL",
let defaultOptions = {
field: this.element.querySelector(".date-picker"),
container: container || this.element.querySelector(".picker-container"),
bound: container === null,
format: this.format,
firstDay: 1,
i18n: {
previousMonth: I18n.t("dates.previous_month"),
nextMonth: I18n.t("dates.next_month"),
months: moment.months(),
weekdays: moment.weekdays(),
weekdaysShort: moment.weekdaysShort(),
},
onSelect: (date) => this._handleSelection(date),
}; };
if (this.relativeDate) {
defaultOptions = Object.assign({}, defaultOptions, {
minDate: moment(this.relativeDate).toDate(),
});
}
return new Pikaday(Object.assign({}, defaultOptions, this._opts()));
});
}, },
}); });

Datei anzeigen

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
# name: discourse-custom-wizard # name: discourse-custom-wizard
# about: Create custom wizards # about: Create custom wizards
# version: 1.15.3 # version: 1.15.4
# authors: Angus McLeod # authors: Angus McLeod
# url: https://github.com/paviliondev/discourse-custom-wizard # url: https://github.com/paviliondev/discourse-custom-wizard
# contact emails: angus@thepavilion.io # contact emails: angus@thepavilion.io