diff options
| author | Loïc Guégan <loic.guegan@mailbox.org> | 2024-09-17 11:12:22 +0200 |
|---|---|---|
| committer | Loïc Guégan <loic.guegan@mailbox.org> | 2024-09-17 11:12:22 +0200 |
| commit | 1b97acaa87a8e8740381573bd3d994344b008043 (patch) | |
| tree | a4d65540763f35311a478311e444898c0cdf10f3 /tropical/env.py | |
| parent | fc2d09d5aef9e89ff09137b64b7001e5bf0babaf (diff) | |
Minor changes
Diffstat (limited to 'tropical/env.py')
| -rw-r--r-- | tropical/env.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/tropical/env.py b/tropical/env.py index e2484fd..59ac509 100644 --- a/tropical/env.py +++ b/tropical/env.py @@ -3,6 +3,8 @@ from pathlib import Path from db import CalDB import configparser from enum import Enum +from datetime import date, timedelta +import datetime, time class EvtRepeat(Enum): DAYLY = 1 @@ -42,5 +44,17 @@ class Env: self.config["global"]={"new":True} with open(self.confFile,"w") as f: self.config.write(f) - + + def listEventsOn(self, yy, mm, dd): + offset=24*3600-1 + d=datetime.date(yy,mm,dd) + start=int(time.mktime(d.timetuple())) + end=start+offset + events=list() + for e in self.db.listEvents(): + if e["start"] >=start and e["start"] <= end: + events.append(e) + # TODO: Account for repeat + + |
