From: Christian Heller <c.heller@plomlompom.de>
Date: Sat, 16 Mar 2024 23:24:38 +0000 (+0100)
Subject: Add previously forgotten days module file, oops.
X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/static/%7B%7B%20web_path%20%7D%7D/decks/templates?a=commitdiff_plain;h=ee7279c0884262d5b329033cf77260fd850a5b91;p=taskplom

Add previously forgotten days module file, oops.
---

diff --git a/days.py b/days.py
new file mode 100644
index 0000000..12328a6
--- /dev/null
+++ b/days.py
@@ -0,0 +1,24 @@
+#!/usr/bin/env python3
+"""Collecting Day and date-related items."""
+from datetime import datetime
+
+DATE_FORMAT = '%Y-%m-%d'
+
+
+class Day:
+    """Individual days defined by their dates."""
+
+    def __init__(self, date):
+        self.date = date
+        self.datetime = datetime.strptime(date, DATE_FORMAT)
+
+    @property
+    def weekday(self):
+        """Return what weekday matches self.date."""
+        return self.datetime.strftime('%A')
+
+    def __eq__(self, other):
+        return self.date == other.date
+
+    def __lt__(self, other):
+        return self.date < other.date