-
-
Save camtheman256/3125e18ba20e90b6252678714e5102fd to your computer and use it in GitHub Desktop.
function exportData() { | |
const peopleMap = {}; | |
for(let i = 0; i < PeopleIDs.length; i++) { | |
peopleMap[PeopleIDs[i]] = PeopleNames[i]; | |
} | |
nameAtSlot = AvailableAtSlot.map(e => e.map(i => peopleMap[i])); | |
timedNames = TimeOfSlot.map((e, i) => [e, nameAtSlot[i]]); | |
return JSON.stringify(timedNames); | |
} |
I have just tried it, got a file from the output of curl, but got some data wrong: at least in one appointment there is a mismatch, the browser shows 5th/Feb 15:00 while the CSV shows Feb 4 13:30.
Is this perhaps a timezone issue?
when2meet allows setting a TZ on the event, and the &csv
version you get is in the event's TZ. So for example https://www.when2meet.com/?28661143-TPGgR has a time range of 9a-5p in the Australia/Darwin TZ, and curl'ing https://www.when2meet.com/?28661143-TPGgR&csv agrees, but viewing the event in a browser with "Your Time Zone" (on the when2meet page) set to US/Pacific shows appointment slots in 3p-12a.
I don't see the event TZ being sent back on the &csv
URL but my guess is that when2meet's owner would add it if asked considering previously excellent responsiveness.
If you need a more immediate way to detect event TZ you can download its non-CSV version and muck through the embedded JS, like this hack: curl -s 'https://www.when2meet.com/?28661143-TPGgR' |sed -ne '/timezone !=/s/.*"\([A-Za-z0-9/_+-]*\)".*/\1/p'
Dear fischman, many thanks for your suggestion you gave to solve my problem. Now I found the problem was a mistake I made: The person I checked the response (and knew that could not be the response) actually answered again later in the spot I was expecting. So online I saw the expected slot, in the CSV, the spot was wrong in a first line, and was correct in a later line. In my mind the same person could not appear two times, so I went to check the two answers and found one space character difference: "name surname" vs "name surname ". Please excuse the confusion I have created and thanks again for the suggestion you gave. At this moment I see your original solution working.
I have a correction to the next text that I wrote "I have just tried it, got a file from the output of curl, but got some data wrong: at least in one appointment there is a mismatch, the browser shows 5th/Feb 15:00 while the CSV shows Feb 4 13:30."
CORRECTION: The person I checked the response (and knew that could not be the response) actually answered again later in the way I was expecting. I saw the first answer, not the second. Interestingly, I believe the two answers entered When2Meet just because the username changed "name surname" to "name surname " (see the space after surname). Please excuse the confusion I created with my text.