Having a large and extended Chinese family I found it hard to keep track of everyone's Chinese birthdays. Although Google Calendar provides alternate calendars, these calendars do not support events or reminders in terms of Chinese dates. I have always overcome this by manually converting the Lunisolar date to the Gregorian date and then creating the corresponding event each year in Google Calendar.
Additionally, Google provides a birthday calendar
which obtains the birthday dates from Google Contacts. However, this calendar lacks reminders and I have found that at times, it does not synchronize correctly. Moreover, this calendar does not properly sync with my Android devices.
Note: The Chinese calendar is often mistaken as a Lunar calendar
when in fact it is a Lunisolar calendar
I wanted a solution that extracts the Chinese and Western birthdays from my Google Contacts and create them as annual events with reminders. As a result, I have created the following Google Contact Birthday Reminders Apps Script.
- Creates Google Calendar events with reminders from Google Contact Western (Gregorian) Birthdays.
- Creates Google Calendar events with reminders from Google Contact Chinese (Lunisolar) Birthdays.
How to use
- Ensure you are logged into the Google Contacts account you wish to generate birthday reminders for.
- Ensure all birthday entries are correct in Google Contacts. A contact can have only a single birthday which can be a Western or Chinese date (Chinese birthdays are distinguished in step 4).
- Dates must be valid (without the error icon ).
- For all contacts that have Chinese birthdays, add them to a new Google Contact Group called: "Chinese Birthdays" (or anything you wish). This contact group will be used by the Apps Script to determine which birthdays are Chinese birthdays. All other contacts not in this new group will be regarded as Western birthdays.
- Authorise the Apps Script below by clicking on the "Click to Authorize" link at the bottom (only needs to be done once).
A new page will pop-up, click on the button and then close the page.Refresh this page: www.palebluepixel.com.au/google-contact-birthday-reminders.
- Note: None of your data is altered except for the new calendar to be created.
Using the Apps Script below, select the "Chinese Birthday" contact group.
Click the "Create Now!" button.
- All listed contacts will be exported to the new Google Calendar.
All done! The new birthday calendar with the selected reminders have now been created in your Google Calendar.
- Please be patient, this may take a while depending on how many contacts you have.
The Apps Script
- Chinese birthday events are generated as single events. This is for compatibility as not all calendars support custom event recurrence patterns (the WebUI of Google Calendar can display them correctly but my Android calendars cannot).
- Since the birthday calendar is manually created, any subsequent updates to Google Contacts do not automatically update the birthday calendar. As such the birthday calendar will need to be re-created by the Apps Script. This is why there is an option to replace/override the previous calendar.
- Chinese birthday events repeat five years from the date of creation. This is to limit the amount of API calls to the Google Calendar API. For me, this isn't a problem as I would have no doubt re-created the birthday calendar due to changes in my Google Contacts.
- Chinese leap months are not currently supported.
The Apps Script presently satisfies my initial purpose but I know it can be improved in many ways. If there is enough demand for a feature, I'm more than happy to implement it. Some of the extra features that could be incorporated include:
- Support for other calendars e.g. Islamic Hijri (Lunar) calendar or Julian.
- Support Chinese leap months.
- Extra flexibility with reminders.
- Speed improvement (dependant on Google API).
- Option to use custom repetition/recurrence events (no compatible with many calendar viewers).
- Add standard dates such as Chinese New Year.
- Add Google Tasks which allow for To-Do's such as the purchasing of presents.
- Add periodic re-creation of the Birthday Calendar e.g. yearly.