fix not working "use enddate" in edit or quickadd

also fix not displayed month in header and add translation of month or week-day names
This commit is contained in:
ralf 2022-08-12 11:38:15 +02:00
parent 9e83b12413
commit 8b45483c68
3 changed files with 17 additions and 7 deletions

View File

@ -442,8 +442,18 @@ export class Et2Date extends Et2InputWidget(FormControlMixin(ValidateMixin(LitFl
this.clear();
return;
}
let date;
// handle relative time (eg. "+3600" or "-3600") used in calendar
if (typeof value === 'string' && (value[0] === '+' || value[0] === '-'))
{
date = new Date(this.getValue());
date.set_value(date.getSeconds() + parseInt(value));
}
else
{
date = new Date(value);
}
// Handle timezone offset, flatpickr uses local time
let date = new Date(value);
let formatDate = new Date(date.valueOf() + date.getTimezoneOffset() * 60 * 1000);
if(!this._instance)
{

View File

@ -3235,7 +3235,7 @@ export class CalendarApp extends EgwApp
}
}
// If current state matches a favorite, hightlight it
// If current state matches a favorite, highlight it
this.highlight_favorite();
// Update app header
@ -3980,7 +3980,7 @@ export class CalendarApp extends EgwApp
{
if (!month_before_day)
{
range += flatpickr.formatDate(first_format, "F");
range += egw.lang(flatpickr.formatDate(first_format, "F"));
}
if (first.getFullYear() != last.getFullYear() && datefmt[0] != 'Y')
{
@ -4003,7 +4003,7 @@ export class CalendarApp extends EgwApp
if (month_before_day)
{
range += flatpickr.formatDate(last_format, 'l');
range += egw.lang(flatpickr.formatDate(last_format, 'l'));
}
}
else if (last)
@ -4024,7 +4024,7 @@ export class CalendarApp extends EgwApp
break;
case 'm':
case 'M':
range += ' ' + flatpickr.formatDate(month_before_day || !last ? first_format : last_format, "l") + ' ';
range += ' ' + egw.lang(flatpickr.formatDate(month_before_day || !last ? first_format : last_format, "F")) + ' ';
break;
case 'Y':
if (datefmt[0] != 'm')

View File

@ -258,8 +258,8 @@ export class et2_calendar_daycol extends et2_valueWidget implements et2_IDetache
// Add timezone offset back in, or formatDate will lose those hours
const formatDate = new Date(this.date.valueOf() + this.date.getTimezoneOffset() * 60 * 1000);
this.title.html('<span class="long_date">' + flatpickr.formatDate(formatDate, 'l') +
'</span><span class="short_date">' + flatpickr.formatDate(formatDate, 'D') + '</span>' +
this.title.html('<span class="long_date">' + egw.lang(flatpickr.formatDate(formatDate, 'l')) +
'</span><span class="short_date">' + egw.lang(flatpickr.formatDate(formatDate, 'D')) + '</span>' +
flatpickr.formatDate(formatDate, 'd'));
}
this.title