shift-org / shift-docs

Shift2Bikes: website and calendar for shift and pedalpalooza
https://shift2bikes.org
Other
22 stars 17 forks source link

Pedalp event list includes Sep 1. #739

Closed ionous closed 5 months ago

ionous commented 5 months ago

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/

ionous commented 5 months ago

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

https://github.com/shift-org/shift-docs/blob/936257c250fc577ea1dce4b8f64be8af7f761212/site/content/pedalpalooza-calendar.md?plain=1#L10

but for the current node code:

https://github.com/shift-org/shift-docs/blob/936257c250fc577ea1dce4b8f64be8af7f761212/app/models/calDaily.js#L240

and even looking back at the old php backend:

https://github.com/shift-org/shift-docs/blob/9443a36c2a1c0497914210a8072b51db4f9f83c5/backend/models/EventTime.php#L98

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?

carrythebanner commented 5 months ago

This looks like the first reference to that "end date is exclusive" comment: https://github.com/shift-org/shift-docs/commit/ce68cadbca7c61f503920010378b5ac43e4f2f9d 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: https://github.com/shift-org/shift-docs/blob/936257c250fc577ea1dce4b8f64be8af7f761212/site/themes/s2b_hugo_theme/layouts/partials/cal/events.html#L20

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.

ionous commented 5 months ago

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.

ionous commented 5 months ago

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.

ionous commented 5 months ago

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.

ionous commented 5 months ago

fixed by #740