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)
{
//@ts-ignore flatpickr adds dateObj to days
let date = dayElement.dateObj;
if(!date || SidemenuDate._holidays === null)
let date = new Date(dayElement.dateObj);
let f_date = new Date(date.valueOf() - date.getTimezoneOffset() * 60 * 1000);
if(!f_date || SidemenuDate._holidays === null)
{
return;
}
let day_holidays = SidemenuDate._holidays[formatDate(date, {dateFormat: "Ymd"})]
let day_holidays = SidemenuDate._holidays[formatDate(f_date, {dateFormat: "Ymd"})]
var tooltip = '';
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
// @ts-ignore
if(egw.window.et2_calendar_view)
if(et2_calendar_view)
{
// @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.year;
}