aboutsummaryrefslogtreecommitdiff
path: root/src/then.nim
diff options
context:
space:
mode:
Diffstat (limited to 'src/then.nim')
-rw-r--r--src/then.nim6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/then.nim b/src/then.nim
index 6137fdf..a74a863 100644
--- a/src/then.nim
+++ b/src/then.nim
@@ -96,6 +96,10 @@ proc checkDateGroup(s: string, date: DateTime): bool =
return false
return true
+proc checkRangeYear(s: string, date: DateTime): bool =
+ var years = s.split('-')
+ return date.year >= years[0] and date.year <= years[1]
+
proc checkCond(cond: string, date: DateTime): bool =
var condition = cond
var invert = false
@@ -126,6 +130,8 @@ proc checkCond(cond: string, date: DateTime): bool =
found = true
of "dategroup":
found = checkDateGroup(condition, date)
+ of "rangeyear":
+ found = checkRangeYear(condition, date)
of "unknown":
echo "ERROR: Unknown condition: ", condition
if invert == true: