-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmethod_1.py
More file actions
38 lines (33 loc) · 1.03 KB
/
method_1.py
File metadata and controls
38 lines (33 loc) · 1.03 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
import datetime
def method_1(date=None):
if date is None:
date = datetime.datetime.utcnow()
epoch = datetime.datetime(2000, 1, 6, 18, 14, 0)
synodic_month = 29.530588853
delta = date - epoch
days = delta.total_seconds() / 86400.0
age = days % synodic_month
if age < 1.84566:
label, icon = "Nouvelle Lune", "🌑"
elif age < 5.536:
label, icon = "Premier Croissant", "🌒"
elif age < 9.228:
label, icon = "Premier Quartier", "🌓"
elif age < 12.920:
label, icon = "Gibbeuse croissante", "🌔"
elif age < 16.611:
label, icon = "Pleine Lune", "🌕"
elif age < 20.302:
label, icon = "Gibbeuse décroissante", "🌖"
elif age < 23.993:
label, icon = "Dernier Quartier", "🌗"
elif age < 27.684:
label, icon = "Dernier Croissant", "🌘"
else:
label, icon = "Nouvelle Lune", "🌑"
return {
"label": label,
"icon": icon,
"day": date.strftime("%d/%m/%Y"),
}
# print(method_1())