Read the statement by Michael Teeuw here.
default calendar in relative mode, shows 1 less day than expected
-
i am helping a user try to get their calendar to display properly
he is in Norway, utc +1, calendar is in correct timezone, and his system date is also in correct timezone.
showEnd is false, and in absolute mode shows the correct date , Feb 21, as the start date for the entry.however in relative mode, it says 8 days. but should be 9. (today being the 12th)
i have been over the code a bunch today, and the ONLY place I can see any consideration for this kind of problem is to check for full day events and adjust the start of the startdate to beginning of day (00:00:00)but then the calc is timeWrapper.innerHTML = this.capFirst(moment(event.startDate, “x”).fromNow());
well, NOW is current local time… so, if its using WHOLE days( truncated, not rounded), then its right, but the user sees it as 9 (21-12).
-
SO… the problem is the calculation uses the local hour to determine from now… but users see days…
so the fix is to truncate NOW to the start of the day…, then the comparison is start of day to start of day…
instead of this
// uses hours/mins/seconds of now.. timeWrapper.innerHTML = this.capFirst(moment(event.startDate, “x”).fromNow());
do this
// uses only date, time is 00:00:00, fullday events also start at 00:00:00 timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").from(moment().format("YYYYMMDD")));