1

I'm trying to set up calendar events in macOS Sierra's Calendar that repeat every 2,551,440 seconds (which happens to be the synodic period of the Moon).

Ultimately, I want a calendar that provides the Moon rise and set times for my location, and it also needs to list the Lunar phase (e.g. Full Moon, New Moon, etc.). I have found plenty of examples on the Internet where people have manually created the events, but that's incredibly tedious (one event per day for years!), and it's based on different time zones (and so are of no use to me).

I have seen from the ICS specifications that the file format itself supports events that recur every x seconds. I then exported an event as an ICS file, and then edited the ICS file in TextEdit, but I must've got the code wrong, as it didn't re-import into macOS Calendar with the correct repeat interval. Instead, it imported a single event with no repetition.

Can someone please explain how to go about doing this?

I found the RRULE Generator, but that only supports hourly intervals, not seconds, and so is not precise enough for my needs.

I considered running a bash script to generate the event (which would run as a cron job every 2,551,440 seconds), but that would only give a month's notice. I'd prefer to have it set up indefinitely.

Another option may be to write a script in Python to create individual ICS event files; this would also be tedious...

I understand that this can't be done in Calendar directly; the solution will most likely be manually editing each ICS file to set up the recurrence correctly, and then importing them into Calendar... I just don't know how...

Thanks in advance for any thoughts.

4
  • Would you be willing to share why you need to do this? Having that context may help the community come up with an 'outside the square' solution that meets your needs, but one you may not have considered (e.g. not involving macOS Sierra's default Calendar app). Also, can you share your location (obviously not exact location, but your city perhaps).
    – Monomeeth
    Nov 29, 2016 at 12:21
  • Sure. Ultimately, the calendar will be used for planning light pollution for amateur astronomers. Knowing what the phase of the Moon is, and when it rises and sets, helps people plan their photography sessions (you need really dark skies to photograph distant galaxies, and the Moon is a major source of light pollution). I am in Melbourne, Australia; I am planning on making several different calendars for different time zones in Australia, though. Thanks! :)
    – ZPMMaker
    Nov 29, 2016 at 13:08
  • Sorry to ask another question, but I'm wondering why you wouldn't just share links like: Brisbane, Melbourne, Adelaide etc and scroll down to view the Astronomy section (below the 10 day forecast) in order to plan around light pollution? Or is there a particular function you're trying to achieve via the Calendar app?
    – Monomeeth
    Nov 30, 2016 at 11:34
  • Because people want a Calendar-based solution instead.
    – ZPMMaker
    Dec 1, 2016 at 21:47

1 Answer 1

0

I know this won't be the answer you were looking for.

In your question you stated:

I then exported an event as an ICS file, and then edited the ICS file in TextEdit, but I must've got the code wrong, as it didn't re-import into macOS Calendar with the correct repeat interval.

Unfortunately you probably didn't get the code wrong.

While you are correct that the ICS specification does indeed support intervals down to the second, the problem is that the default macOS Calendar app doesn't support this (at least not in terms of repeat or recurrence values). So, what you want to do is not possible with the default macOS Calendar app. In fact, the problem you have is twofold, as the Calendar app does not recognise intervals:

  1. shorter than a day
  2. not represented as whole numbers

To explain this further, the first problem above would not necessarily be an issue if the Calendar app accepted a decimal value to enough decimal points, because then you could enter an event that repeated every 29.53 days.

However, even if the app did accept a decimal value, it'd likely be limited to no more than one decimal place, which won't be precise enough when dealing with days.

Unfortunately, MS Outlook won't work for you either (it doesn't accept anything less than daily intervals and even though you can enter decimal values, it just rounds them up or down).

And Fantastical, while an excellent calendar app for macOS, is as limited as the default calendar in this regard.

Instead, what you will need to do is:

  • find a solution that registers intervals shorter than a day, or works with decimal values, or
  • download one of the existing astronomical calendars for this purpose and then manually edit the ICS file to change the time zone to suit the various Australian ones you need.

Sorry this isn't what you were looking for, but maybe the second 'download and edit' option will work for you without too much effort.

4
  • 2
    Thanks for your thoughts, @Monomeeth; I appreciate it greatly. Actually, I figured that was the case too, and asked a friend, who helped me write a script to loop through and create the events individually rather than making a single repeating event. That said, it didn't help in the end anyway, because the Moon's orbit is inclined relative to the Earth's equator, and so there isn't a constant interval between phases. Eventually, my friend found out the US Navy has an API that provides all the data I need. That solved the problem.
    – ZPMMaker
    Dec 3, 2016 at 9:46
  • That's great - I'm glad you found a solution! :)
    – Monomeeth
    Dec 3, 2016 at 9:47
  • @ZPMMaker Is this script you mentioned opensource/available for others to make moon calendar events via the US Navy API? I stumbled on your question because I am also looking for a good way to get location specific lunar calendar in my personal calendar.
    – Wimateeka
    Oct 26, 2022 at 12:48
  • 1
    @Wimateeka, the script I ended up using is not open source because it is part of a much larger commercial project, but it's literally just one line of code based on the documentation on the US Navy website.
    – ZPMMaker
    Oct 31, 2022 at 1:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .