diff options
| author | historia <[not public]> | 2026-06-29 14:39:14 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-06-29 14:39:14 -0400 |
| commit | 004836b349ffd9d6e7ec08926d26753ae274a604 (patch) | |
| tree | 15fd29facc47ad9c951824bcb3438e44bf3e7401 /src | |
| parent | 197cefb0bbc1806892cc2d392f94124f5351e8c3 (diff) | |
| download | soon-004836b349ffd9d6e7ec08926d26753ae274a604.tar.gz | |
feat: dates wrap around, e.g. 29-4 works as a condition
Diffstat (limited to 'src')
| -rw-r--r-- | src/soon/conditionchecker.nim | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/soon/conditionchecker.nim b/src/soon/conditionchecker.nim index 691c42a..ada152c 100644 --- a/src/soon/conditionchecker.nim +++ b/src/soon/conditionchecker.nim @@ -101,7 +101,7 @@ proc checkRangeMonth(s: string, date: DateTime): bool = proc checkRangeDay(s: string, date: DateTime): bool = let days = s.split('-') - return date.monthday >= parseInt(days[0]) and date.monthday <= parseInt(days[1]) + return isInLoopingRange(parseInt(days[0]), parseInt(days[1]), date.monthday) proc checkRangeWeekday(s: string, date: DateTime): bool = let wdays = s.split('-') @@ -136,12 +136,12 @@ proc dateGroupStringToDate*(s: string, comparisonDate: DateTime): DateTime = t["year"] = comparisonDate.year if not t.hasKey("month") or not t.hasKey("day") or t["month"] < 1 or t["month"] > 12: invalidConditions.incl(s) - return dateTime(1, mJan, 1, 0, 0, 0, 0, utc()) + return dateTime(1, mJan, 1, 0, 0, 0, 0, local()) try: - return dateTime(t["year"], Month(t["month"]), t["day"], 0, 0, 0, 0, utc()) + return dateTime(t["year"], Month(t["month"]), t["day"], 0, 0, 0, 0, local()) except CatchableError: invalidConditions.incl(s) - return dateTime(1, mJan, 1, 0, 0, 0, 0, utc()) + return dateTime(1, mJan, 1, 0, 0, 0, 0, local()) proc isValidDateGroupRange(s: string): bool = let dates = s.split('-') |
