Google Calendar本身没有阴历日历的功能,只能通过生成然后导入的方式添加。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys
import sxtwl

if(len(sys.argv) != 3 or len(sys.argv[2]) != 8):
exit('Usage: python lunar_brithday <name> <birth day(YYYYMMDD)>')

lunar = sxtwl.Lunar()

birth_year = int(sys.argv[2][:4])
birth_month = int(sys.argv[2][4:6])
birth_day = int(sys.argv[2][6:8])

day = lunar.getDayBySolar(birth_year, birth_month, birth_day)

lunar_birth_month = (day.Lmc + 11) % 12
lunar_birth_day = day.Ldi + 1

print("Subject,Start Date,All Day Event")

for i in range(100):
day = lunar.getDayByLunar(birth_year+i, lunar_birth_month, lunar_birth_day)
print(sys.argv[1] + '\'s lunar birthday,' + str(day.m) + '/' + str(day.d) + '/' + str(day.y) + ',TRUE')
# Subject,Start Date,All Day Event