Thanks for posting the solution.
The Week.FirstDayOfWeek method is as simple as this:
public static DateTime FirstDayOfWeek(DateTime day, DayOfWeek weekStarts)
{
DateTime d = day;
while (d.DayOfWeek != weekStarts)
{
d = d.AddDays(-1);
}
return d;
}
The problem seems to be somewhere else.
All times are passed as relative values to the client-side (that means the server time zone is ignored and "2007-12-14 15:00:00 +0900" is passed as "2007-12-14 15:00:00 +0000") and they during the lifetime of the client objects they are handled as GMT values.
The reason for this is that IE and FF handle summer time differently (IE is converting the time to a the summer time zone automatically during setTime() operations).
For passing the DateTime values DayPilot is using the following method:
public static string FormatDateTime(DateTime dt)
{
return dt.ToString("MMMM d, yyyy HH:mm:ss +0000", CultureInfo.CreateSpecificCulture("en-US"));
}
You are passing it as
new Date(" + date.Year + ", " + (date.Month - 1) + ", " + date.Day + ") which most likely adds the current time zone to it. You can try using this instead:
Gaia.WebWidgets.Manager.Instance.AddScriptForClientSideEval(calSchema.ClientObjectName +
".refreshCallBack(new Date(" + DayPilot.Utils.JsDate.FormatDateTime(d) + "),null);");