diff --git a/htmlmodules.py b/htmlmodules.py
index 6df7eab..39a7e05 100644
--- a/htmlmodules.py
+++ b/htmlmodules.py
@@ -481,29 +481,38 @@ def module_filterselection(keys,time=True,delimit=False):
thismonth = today[:2]
thisyear = thismonth[:1]
+ ### temp!!! this will not allow weekly rank changes
+ weekday = ((now.isoweekday()) % 7)
+ weekbegin = now - datetime.timedelta(days=weekday)
+ weekend = weekbegin + datetime.timedelta(days=6)
+ weekbegin = [weekbegin.year,weekbegin.month,weekbegin.day]
+ weekend = [weekend.year,weekend.month,weekend.day]
+ weekbeginstr = "/".join((str(num) for num in weekbegin))
+ weekendstr = "/".join((str(num) for num in weekend))
+
html += "
"
if timekeys.get("since") == today or timekeys.get("within") == today:
html += "
Today"
else:
- html += "
Today"
+ html += "
Today"
html += " | "
- if keys.get("since") == "sunday":
+ if timekeys.get("since") == weekbegin and timekeys.get("to") == weekend:
html += "
This Week"
else:
- html += "
This Week"
+ html += "
This Week"
html += " | "
if timekeys.get("since") == thismonth or timekeys.get("within") == thismonth:
html += "
This Month"
else:
- html += "
This Month"
+ html += "
This Month"
html += " | "
if timekeys.get("since") == thisyear or timekeys.get("within") == thisyear:
html += "
This Year"
else:
- html += "
This Year"
+ html += "
This Year"
html += " | "
if timekeys.get("since") is None and timekeys.get("within") is None:
diff --git a/malojatime.py b/malojatime.py
index 2c6fc12..84036e6 100644
--- a/malojatime.py
+++ b/malojatime.py
@@ -65,14 +65,32 @@ def time_fix(t):
if isinstance(t,str): t = t.split("/")
#if isinstance(t,tuple): t = list(t)
+ try:
+ t = [int(p) for p in t]
+ return t[:3]
+ except:
+ pass
- t = [int(p) for p in t]
+ if t[1].startswith("W"):
+ try:
+ weeknum = int(t[1][1:])
+ return [t[0],"W",t[1]]
+ except:
+ pass
- return t[:3]
+# checks if time is a week
+def is_week(t):
+ return ((len(t) == 3) and (t[1] == "W"))
+def week_to_days(t):
+ pass
# makes times the same precision level
def time_pad(f,t,full=False):
f,t = time_fix(f), time_fix(t)
+
+ # week handling
+
+
while (len(f) < len(t)) or (full and len(f) < 3):
if len(f) == 1: f.append(1)
elif len(f) == 2: f.append(1)