Calendar: Fix holidays in sidemenu calendar off by 1 day

This commit is contained in:
nathan 2022-04-29 09:12:22 -06:00
parent e5f238584e
commit 991a53c5d6
2 changed files with 6 additions and 5 deletions

View File

@ -175,13 +175,14 @@ export class SidemenuDate extends Et2Date
protected _onDayCreate(dates : Date[], dStr : string, inst, dayElement : HTMLElement) protected _onDayCreate(dates : Date[], dStr : string, inst, dayElement : HTMLElement)
{ {
//@ts-ignore flatpickr adds dateObj to days //@ts-ignore flatpickr adds dateObj to days
let date = dayElement.dateObj; let date = new Date(dayElement.dateObj);
if(!date || SidemenuDate._holidays === null) let f_date = new Date(date.valueOf() - date.getTimezoneOffset() * 60 * 1000);
if(!f_date || SidemenuDate._holidays === null)
{ {
return; return;
} }
let day_holidays = SidemenuDate._holidays[formatDate(date, {dateFormat: "Ymd"})] let day_holidays = SidemenuDate._holidays[formatDate(f_date, {dateFormat: "Ymd"})]
var tooltip = ''; var tooltip = '';
if(typeof day_holidays !== 'undefined' && day_holidays.length) if(typeof day_holidays !== 'undefined' && day_holidays.length)
{ {

View File

@ -278,10 +278,10 @@ export class CalendarApp extends EgwApp
// Set client side holiday cache for this year // Set client side holiday cache for this year
// @ts-ignore // @ts-ignore
if(egw.window.et2_calendar_view) if(et2_calendar_view)
{ {
// @ts-ignore // @ts-ignore
egw.window.et2_calendar_view.holiday_cache[content.data.year] = content.data.holidays; et2_calendar_view.holiday_cache[content.data.year] = content.data.holidays;
delete content.data.holidays; delete content.data.holidays;
delete content.data.year; delete content.data.year;
} }