Gearside Design

Google Daylight Calendar

This is a Google Calendar that you can subscribe to that displays the amount of daylight for your day or week views. Now you can visualize where the sunrise and sunset are in relation to your events! “But Google Calendar already has a sunrise/sunset calendar.” I know, and I used to use it, but it just simply isn’t useful. Unlike the stock Google Calendar, the Gearside Daylight calendar uses the start and end times to create the event instead of making it an all-day event (so you can actually see where it falls). Additionally, my calendar also calculates the amount of daylight there is each day! Convinced? Keep reading!

Prepare your options

Odds are you probably don’t live in Syracuse, NY, so the sunrise and sunset times for me won’t help you at all. Therefore, you’ll need to use certain query strings to tell my script where you’re from. You’ll need to know your geo coordinates (latitude and longitude), and your timezone name or GMT offset.

If you don’t know how to find these options here’s some help:

URL structure

Use the values that you found from the last step and put them into the following format. Replace the numbers below with the ones that you generated!

Most Reliable Method
https://gearside.com/calendars/daylight.php?lat=43.1234&lng=-76.1234&timezone=America/New_York

Alternate Method
https://gearside.com/calendars/daylight.php?lat=43.1234&lng=-76.1234&gmt=-5

Syracuse, NY
Those in Central New York will also get weather forecasts. In this case you can call the calendar without any parameters:
https://gearside.com/calendars/daylight.php

Importing into Google Calendar

Navigate to your Google Calendar and click the dropdown arrow next to “Other Calendars” on the left sidebar of the page. Select “Add by URL” and paste the customized URL structure from above into the input field that appears:

add-by-url

How do I delete and re-import this calendar?

Click the settings icon in the upper right (it looks like a gear), and choose “Settings”. Then click “Calendars” in the upper left side. Finally, find the calendar in the list below (it’ll be in the second group) and in the appropriate row, click “Unsubscribe” on the far right side.

Why isn’t my Google Calendar updating?

Google Calendar will cache data, so when you re-import you may need to clear the cache by adding more text into the query string. This is accomplished by adding something like “&nocache” to the end of the URL. The letters themselves do not matter, and you will have to change it every time you import, so you could use “&nocache2” or even “&adfgwdfg“. Note: If there are no other query parameters in the URL, you would need to change the “&” to a “?”, for example: “?nocache“.

Something Isn’t Working?

While comments on this post are great for troubleshooting or sharing ideas with one another, the best and most reliable way to bring an error or something to my attention is on GitHub.

For errors, bugs, or feature requests with the code itself: GitHub Issues
For general questions, configuration, or other minor things: GitHub Discussions

Please provide as much detailed information as possible (and screenshots help a ton) and I can do my best to help. Please keep in mind that this started as a personal project that I thought could be useful for others, so while I provide no guarantee of uptime or that it will even work at all, I do like to make it as good as it can be for myself and others.