diff options
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 + + |
