diff --git a/src/formatters.nim b/src/formatters.nim index 395cf31..51d2174 100644 --- a/src/formatters.nim +++ b/src/formatters.nim @@ -96,10 +96,11 @@ proc getTweetTime*(tweet: Tweet): string = tweet.time.format("h:mm tt' ยท 'MMM d', 'YYYY") proc getShortTime*(tweet: Tweet): string = - let - now = now().utc - then = tweet.time.utc - since = now - then + let now = now() + var then = tweet.time.local() + then.utcOffset = 0 + + let since = now - then if now.year != then.year: result = tweet.time.format("d MMM yyyy") @@ -112,7 +113,6 @@ proc getShortTime*(tweet: Tweet): string = elif since.inSeconds > 1: result = $since.inSeconds & "s" else: - # this shouldn't happen, but just in case result = "now" proc getLink*(tweet: Tweet; focus=true): string = diff --git a/src/parserutils.nim b/src/parserutils.nim index 814066e..a4fb8e6 100644 --- a/src/parserutils.nim +++ b/src/parserutils.nim @@ -36,7 +36,7 @@ template getError*(js: JsonNode): Error = template parseTime(time: string; f: static string; flen: int): Time = if time.len != flen: return - parseTime(time, f, utc()) + parse(time, f).toTime proc getDateTime*(js: JsonNode): Time = parseTime(js.getStr, "yyyy-MM-dd\'T\'HH:mm:ss\'Z\'", 20)