diff options
| author | historia <[not public]> | 2025-08-11 15:09:08 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2025-08-11 15:09:08 -0400 |
| commit | cb35bd463a53383c06e60be4d843bdf1e7d9d68b (patch) | |
| tree | 7f936e4de575d403fcb887d92fa34756c55e9976 /src | |
| parent | a3e3aae87e8f159749863987dfaff336a9ef89fe (diff) | |
| download | soon-cb35bd463a53383c06e60be4d843bdf1e7d9d68b.tar.gz | |
fix: deadline wasn't parsing years
Diffstat (limited to 'src')
| -rw-r--r-- | src/soon.nim | 2 | ||||
| -rw-r--r-- | src/soon/conditionchecker.nim | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/soon.nim b/src/soon.nim index 61ac16d..62dbfcf 100644 --- a/src/soon.nim +++ b/src/soon.nim @@ -11,7 +11,7 @@ Usage: soon [options] Options: -a print agenda --c print reference calendar +-c print reference calendar (using 'cal') -t print todos -d print deadlines -e open default calendar file in $EDITOR diff --git a/src/soon/conditionchecker.nim b/src/soon/conditionchecker.nim index f3eea22..eea5afb 100644 --- a/src/soon/conditionchecker.nim +++ b/src/soon/conditionchecker.nim @@ -31,8 +31,8 @@ proc weekdayToInt(w: string): int = let weekday = w.expandWeekday return find(weekdays, weekday) -# Returns MJD as if date was UTC proc modifiedJulianDay*(date: DateTime): int = +# Returns MJD as if date was UTC let dayZero = dateTime(1858, mNov, 17, 0, 0, 0, 0, utc()) let dateUTC = dateTime(date.year, date.month, date.monthday, 0, 0, 0, 0, utc()) return (dateUTC - dayZero).inDays @@ -44,8 +44,8 @@ proc getWeekFromEnd(date: DateTime): int = proc getWeek(date: DateTime): int = return int((date.monthDay - 1) / 7) + 1 -# Generically checks forwards (Mon-Fri) and backwards (Dec-Feb) ranges proc isInLoopingRange(left: int, right: int, date: int): bool = +# Generically checks forwards (Mon-Fri) and backwards (Dec-Feb) ranges if left <= right: return left <= date and right >= date else: @@ -115,14 +115,15 @@ proc conditionToInt(c: string): int = return parseInt(c) proc dateGroupStringToTable(s: string): Table[string, int] = - let conditions = s[1..s.len-2].splitWhitespace + # This used to be s.len-2 for some reason and I don't know why, but it left off the last condition + let conditions = s[1..s.len-1].splitWhitespace var t = initTable[string, int]() for c in conditions: t[typechecker.checkType(c)] = conditionToInt(c) return t -# comparisonDate is used for strings with no year like (Aug 15) proc dateGroupStringToDate*(s: string, comparisonDate: DateTime): DateTime = +# comparisonDate is used for strings with no year like (Aug 15) var t = dateGroupStringToTable(s) if not t.hasKey("year"): t["year"] = comparisonDate.year |
