In my home.html file, the script below is responsible for:
- Connecting the website to a Google Calendar API
- Fetching dates and names of rocket launches
My concern arises when a calendar for the same rocket has multiple launches in a single month. I aim for the loop to only add the next upcoming launch/event instead of just the last one by skipping all previous entries.
Any suggestions or advice would be greatly appreciated!
Below is the data extracted from the Google Calendar API.
Array(25)
0
:
{name: '(NET) Hanbit-TLV • Test Flight', eventdate: '12/15/2022 12:00 AM'}
1
:
{name: '(NET) Kestrel I • Test Flight', eventdate: '12/15/2022 11:00 PM'}
2
:
{name: 'Long March CZ-11 • Shenjian 2013', eventdate: '12/16/2022 6:00 AM'}
3
:
{name: 'Falcon 9 B5 • SWOT', eventdate: '12/16/2022 11:46 AM'}
4
:
{name: 'Falcon 9 B5 • O3b mPOWER 1–2', eventdate: '12/16/2022 9:21 PM'}
5
:
{name: 'Falcon 9 B5 • Starlink 3557–3610', eventdate: '12/16/2022 9:54 PM'}
6
:
{name: 'Electron • Hawk 6A/B/C', eventdate: '12/16/2022 11:00 PM'}
7
:
{name: 'Vega C • Pléiades Neo 5–6', eventdate: '12/20/2022 1:47 AM'}
8
:
{name: '(NET) Terran 1 • Test Flight', eventdate: '12/25/2022 12:00 AM'}
9
:
... (the list continues)
(index):561
Array(5)
0
:
{name: 'Electron', eventdate: '12/16/2022 11:00 PM'}
1
:
{name: 'Falcon 9 B5', eventdate: '01/01/2023 12:00 AM'}
2
:
{name: 'New Shepard', eventdate: ''}
3
:
{name: 'SpaceShipTwo', eventdate: ''}
4
:
{name: 'Gaofen 14', eventdate: ''}
<!DOCTYPE html>
<html lang="en">
{% load static %}
{%include "Base.html"%}
<!-- Cache Eraser -->
...