mirror of
https://github.com/wekan/wekan.git
synced 2025-12-22 10:20:14 +01:00
Teams/Organizations: Added more code to Admin Panel for saving and editing. In Progress.
Thanks to xet7 ! Related #802
This commit is contained in:
parent
b8d52a5aa8
commit
1bc07b1b4a
8 changed files with 345 additions and 178 deletions
|
|
@ -1,6 +1,9 @@
|
|||
// Helper function to replace HH with H for 24 hours format, because H allows also single-digit hours
|
||||
function adjustedTimeFormat() {
|
||||
return moment.localeData().longDateFormat('LT').replace(/HH/i, 'H');
|
||||
return moment
|
||||
.localeData()
|
||||
.longDateFormat('LT')
|
||||
.replace(/HH/i, 'H');
|
||||
}
|
||||
|
||||
DatePicker = BlazeComponent.extendComponent({
|
||||
|
|
@ -82,7 +85,11 @@ DatePicker = BlazeComponent.extendComponent({
|
|||
},
|
||||
'keyup .js-time-field'() {
|
||||
// parse for localized time format in strict mode
|
||||
const dateMoment = moment(this.find('#time').value, adjustedTimeFormat(), true);
|
||||
const dateMoment = moment(
|
||||
this.find('#time').value,
|
||||
adjustedTimeFormat(),
|
||||
true,
|
||||
);
|
||||
if (dateMoment.isValid()) {
|
||||
this.error.set('');
|
||||
}
|
||||
|
|
@ -97,7 +104,11 @@ DatePicker = BlazeComponent.extendComponent({
|
|||
const newTime = moment(time, adjustedTimeFormat(), true);
|
||||
const newDate = moment(evt.target.date.value, 'L', true);
|
||||
const dateString = `${evt.target.date.value} ${time}`;
|
||||
const newCompleteDate = moment(dateString, 'L ' + adjustedTimeFormat(), true);
|
||||
const newCompleteDate = moment(
|
||||
dateString,
|
||||
'L ' + adjustedTimeFormat(),
|
||||
true,
|
||||
);
|
||||
if (!newTime.isValid()) {
|
||||
this.error.set('invalid-time');
|
||||
evt.target.time.focus();
|
||||
|
|
@ -110,7 +121,7 @@ DatePicker = BlazeComponent.extendComponent({
|
|||
this._storeDate(newCompleteDate.toDate());
|
||||
Popup.close();
|
||||
} else {
|
||||
if (!this.error){
|
||||
if (!this.error) {
|
||||
this.error.set('invalid');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue