| 1 |
"""Adapter for VJOURNAL.""" |
| 2 |
|
| 3 |
from recurring_ical_events.adapters.component import ComponentAdapter |
| 4 |
from recurring_ical_events.constants import DATE_MIN_DT |
| 5 |
from recurring_ical_events.types import Time |
| 6 |
from recurring_ical_events.util import cached_property |
| 7 |
|
| 8 |
|
| 9 |
class JournalAdapter(ComponentAdapter): |
| 10 |
"""Apdater for journal entries.""" |
| 11 |
|
| 12 |
@staticmethod |
| 13 |
def component_name() -> str: |
| 14 |
"""The icalendar component name.""" |
| 15 |
return "VJOURNAL" |
| 16 |
|
| 17 |
@property |
| 18 |
def end_property(self) -> None: |
| 19 |
"""There is no end property""" |
| 20 |
|
| 21 |
@property |
| 22 |
def raw_start(self) -> Time: |
| 23 |
"""Return DTSTART if it set, do not panic if it's not set.""" |
| 24 |
|
| 25 |
dtstart = self._component.get("DTSTART") |
| 26 |
if dtstart is not None: |
| 27 |
return dtstart.dt |
| 28 |
return DATE_MIN_DT |
| 29 |
|
| 30 |
@cached_property |
| 31 |
def raw_end(self) -> Time: |
| 32 |
"""The end time is the same as the start.""" |
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
return self.raw_start |
| 37 |
|
| 38 |
|
| 39 |
__all__ = ["JournalAdapter"] |