Closed apg-dev closed 4 years ago
Hello, looks like a bug. What timezone are you in? Wondering if it might be caused by that (for me it works fine but I'm close to GMT ...
EST USA (UTC/GMT - 5 hours). Seems to be independent of the time of day.
Looks like you're right - it is timezone related.
I wrote the following code to determine the user's local timezone then convert activeDate to GMT. I tested this in my local environment and it works fine.
In /src/public/javascripts/widgets/calendar.js
REPLACE line 44:
this.activeDate = new Date(Date.parse(activeDate));
With these four lines:
var activeDateLocal = new Date(activeDate);
var tzo = activeDateLocal.getTimezoneOffset();
var activeDateGMT = new Date(activeDateLocal.setMinutes( activeDateLocal.getMinutes() + tzo ));
this.activeDate = activeDateGMT;
Let me know if you'd like me to create a formal patch.
Your patch is far more elegant and simple than the hack I put together. Thank you for the fix - works great.
I can't figure out why the calendar widget highlights "yesterday's" date, not today. I see this regardless of which date I click on, the day prior to the one selected gets the “calendar-date-active” class setting. Looking at calendar.js, activeDate seems to be off by -1.