Compare commits
2 Commits
2bd954e43a
...
88e709f7db
Author | SHA1 | Date | |
---|---|---|---|
|
88e709f7db | ||
|
2ca52c339d |
@ -271,6 +271,10 @@ class Headline:
|
|||||||
|
|
||||||
return "".join(contents).rstrip()
|
return "".join(contents).rstrip()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def id(self):
|
||||||
|
return self.get_property("ID")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def clock(self):
|
def clock(self):
|
||||||
times = []
|
times = []
|
||||||
@ -583,13 +587,11 @@ class TimeRange:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def start(self) -> datetime:
|
def start(self) -> datetime:
|
||||||
st = self.start_time
|
return self.start_time.time.to_datetime()
|
||||||
return datetime(st.year, st.month, st.day, st.hour or 0, st.minute or 0)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def end(self) -> datetime:
|
def end(self) -> datetime:
|
||||||
et = self.end_time
|
return self.end_time.time.to_datetime()
|
||||||
return datetime(et.year, et.month, et.day, et.hour or 0, et.minute or 0)
|
|
||||||
|
|
||||||
|
|
||||||
def parse_time(value: str) -> Union[None, TimeRange, OrgTime]:
|
def parse_time(value: str) -> Union[None, TimeRange, OrgTime]:
|
||||||
@ -620,6 +622,13 @@ class OrgTime:
|
|||||||
self.time = ts
|
self.time = ts
|
||||||
self.end_time = end_time
|
self.end_time = end_time
|
||||||
|
|
||||||
|
@property
|
||||||
|
def duration(self):
|
||||||
|
if self.end_time is None:
|
||||||
|
return timedelta() # No duration
|
||||||
|
else:
|
||||||
|
return self.end_time.to_datetime() - self.time.to_datetime()
|
||||||
|
|
||||||
def to_raw(self):
|
def to_raw(self):
|
||||||
return timestamp_to_string(self.time, self.end_time)
|
return timestamp_to_string(self.time, self.end_time)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user