shift-org/shift-docs

Pedalp event list includes Sep 1.

Closed this issue · 6 comments

on https://www.shift2bikes.org/pedalpalooza-calendar/ scroll to the end, and note the last event occurs on Sep1.

i went back to check on a commit before any of the recent event list changes. this deploy is from May 31, and it shows the same issue:

https://665abd273650b1000833f3cd--shift-docs.netlify.app/pedalpalooza-calendar/

there's a comment in the markdown that the enddates are exclusive:

enddate: 2024-09-01 # end date is exclusive

but for the current node code:

.where('eventdate', '<=', lastDay.toDate())

and even looking back at the old php backend:

'eventdate<=' => $lastDay,

that doesn't seem to be the case for grabbing the event list.

i wonder if the comment was wrong, or if there is some other piece of code ( ex. in the front end ) that is expecting it to be exclusive.

@carrythebanner maybe?

This looks like the first reference to that "end date is exclusive" comment: ce68cad That was 2020, and that year we had a improvised way to display "themes" for each day instead of rides. It's possible that something was wonky there and then propagated forward without me realizing it?

Should look at the PP date handling, starting here — I may have introduced some bugs or done some weird date parsing without realizing it:

if ({{ .Param "pp" }} && ( {{ .Param "year" }} >= 2008 ) ) {

Either way, I believe we use inclusive dates everywhere else so we should try to get back to using inclusive dates here, too. If there really is a discrepancy where one part of the code needs an exclusive date, we could just nudge the date in that part of the code.

some notes:

in this example, the end of the week that includes the last day of june is july 6th

image

when fullcal makes its request it sends: 2024-07-07T00:00:00-07:00
which in PST is Sun Jul 07 2024 00:00:00

the node code parses that with dayjs(end || null, 'YYYY-MM-DD', false); which essentially chops off the time. ( in the debugger, formatting that result with 'YYYY-MM-DD' yields 2024-07-07 ) and the last event returned in the event query is:

"date": "2024-07-07",
"shareable": "http://localhost:3080/calendar/event-19366",

august ends with the 31 on saturday:

image

and full call requests:
http://localhost:3080/api/events.php?startdate=2024-07-28T00%3A00%3A00-07%3A00&enddate=2024-09-01T00%3A00%3A00-07%3A00
the server chops that to 2024-09-01 and the returned events include http://localhost:3080/calendar/event-18518 which takes place on the first.

the fullcal field validRange must separately block off display (and access to) the next month on its view, regardless of the range it requested.


it's possible that the php code handled the time differently: strictly less than or equal to the data and time. so ( for example ) Sun Jul 07 2024 00:00:00 would have been only dates on the 6th.

pulling back the .md to enddate: 2024-08-31 results in

http://localhost:3080/api/events.php?startdate=2024-07-28T00%3A00%3A00-07%3A00&enddate=2024-08-31T00%3A00%3A00-07%3A00

which means the server returns, inclusively, the 31 -- but fullcal still filters based on its 00:00:00 interpretation, and indeed excludes the events on the final day.

image

ugh.

and here's the relevant documenation:
https://fullcalendar.io/docs/endParam

In line with the discussion about the Event object, it is important to stress that the value of this endParam date is exclusive just like elsewhere in the FullCalendar API.

fixed by #740