feat: pretty print date fields
This commit is contained in:
parent
3b04af08ab
commit
c0dee1e249
5 changed files with 58 additions and 6 deletions
|
|
@ -97,3 +97,11 @@
|
|||
{"description":"humanize dates: make dates readable to a human being","entry":"20230831T092044Z","modified":"20230831T092044Z","status":"pending","uuid":"ea4fd6c8-f7d0-4b85-af26-feeb2b196f29","tags":["feat"]}
|
||||
{"description":"humanize dates: make dates readable to a human being","entry":"20230831T092044Z","modified":"20230831T092056Z","start":"20230831T092056Z","status":"pending","uuid":"ea4fd6c8-f7d0-4b85-af26-feeb2b196f29","tags":["feat"]}
|
||||
{"description":"humanize dates: make dates readable to a human being","end":"20230831T094605Z","entry":"20230831T092044Z","modified":"20230831T094605Z","status":"completed","uuid":"ea4fd6c8-f7d0-4b85-af26-feeb2b196f29","tags":["feat"]}
|
||||
{"description":"up\/down dirs: display summary of databases further up or down the current one.","end":"20230831T114307Z","entry":"20230830T193044Z","modified":"20230831T114307Z","status":"deleted","uuid":"1372c26f-b4e3-45b5-80ca-6d052af8f28e","tags":["feat"]}
|
||||
{"description":"up down dirs: display summary of databases further up or down the current one.","end":"20230831T114307Z","entry":"20230830T193054Z","modified":"20230831T114307Z","status":"deleted","uuid":"16684e35-9eb4-452d-aa68-84ef57309e00","tags":["feat"]}
|
||||
{"description":"up\/down dirs: display summary of databases further up or down the current one. p:H","end":"20230831T114324Z","entry":"20230830T193029Z","modified":"20230831T114324Z","status":"deleted","uuid":"fc270e5d-23fd-4824-ad9d-061d624272d9","tags":["feat"]}
|
||||
{"description":"timezone: handle timezone in date conversion","entry":"20230831T184955Z","modified":"20230831T184955Z","status":"pending","uuid":"462b9cae-5fbb-4fcc-ab04-41cbd7a44546","tags":["bug"]}
|
||||
{"description":"visual deps: find an efficient way to show dependencies","entry":"20230831T193007Z","modified":"20230831T193007Z","status":"pending","uuid":"b3bd2bc3-3857-42b9-8168-5e21bcddbec5","tags":["design","feat"]}
|
||||
{"description":"more themes","entry":"20230812T182344Z","modified":"20230901T061120Z","priority":"L","status":"pending","uuid":"9ee183d4-3413-4efa-ba68-10d709669c05","tags":["themes"],"depends":["1a5aab4a-0c2b-444f-9259-6eddc29b9791"]}
|
||||
{"description":"date pretty print: pretty print date fields","end":"20230901T061227Z","entry":"20230830T113831Z","modified":"20230901T061227Z","priority":"L","status":"completed","uuid":"85c7d0dc-4651-4f23-a2ec-9db62937cffd","tags":["feat"]}
|
||||
{"description":"timezone: handle timezone in date conversion","end":"20230901T062331Z","entry":"20230831T184955Z","modified":"20230901T062331Z","status":"completed","uuid":"462b9cae-5fbb-4fcc-ab04-41cbd7a44546","tags":["bug"]}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
[description:"timezone: handle timezone in date conversion" end:"1693549411" entry:"1693507795" modified:"1693549411" status:"completed" tags:"bug" tags_bug:"x" uuid:"462b9cae-5fbb-4fcc-ab04-41cbd7a44546"]
|
||||
[description:"date pretty print: pretty print date fields" end:"1693548747" entry:"1693395511" modified:"1693548747" priority:"L" status:"completed" tags:"feat" tags_feat:"x" uuid:"85c7d0dc-4651-4f23-a2ec-9db62937cffd"]
|
||||
[description:"up\/down dirs: display summary of databases further up or down the current one. p:H" end:"1693482204" entry:"1693423829" modified:"1693482204" status:"deleted" tags:"feat" tags_feat:"x" uuid:"fc270e5d-23fd-4824-ad9d-061d624272d9"]
|
||||
[description:"up\/down dirs: display summary of databases further up or down the current one." end:"1693482187" entry:"1693423844" modified:"1693482187" status:"deleted" tags:"feat" tags_feat:"x" uuid:"1372c26f-b4e3-45b5-80ca-6d052af8f28e"]
|
||||
[description:"up down dirs: display summary of databases further up or down the current one." end:"1693482187" entry:"1693423854" modified:"1693482187" status:"deleted" tags:"feat" tags_feat:"x" uuid:"16684e35-9eb4-452d-aa68-84ef57309e00"]
|
||||
[description:"humanize dates: make dates readable to a human being" end:"1693475165" entry:"1693473644" modified:"1693475165" status:"completed" tags:"feat" tags_feat:"x" uuid:"ea4fd6c8-f7d0-4b85-af26-feeb2b196f29"]
|
||||
[description:"touch filtered: point out tasks matching a non-editing filtered command" end:"1693473273" entry:"1693472975" modified:"1693473273" status:"completed" tags:"feat" tags_feat:"x" uuid:"c5835e89-fd7d-45bf-82ed-b38cd0d56b43"]
|
||||
[description:"theme config: use taskwarrior theme config and extends from there." end:"1693324188" entry:"1692471868" modified:"1693324188" priority:"H" status:"completed" tags:"feat,themes" tags_feat:"x" tags_themes:"x" uuid:"6b248843-1b11-487b-85e8-a96e668f6772"]
|
||||
|
|
|
|||
|
|
@ -1,12 +1,9 @@
|
|||
[description:"semantic tags : allow tags starting with a hash to refer to a github issue or PR" entry:"1691773642" modified:"1692121563" priority:"L" status:"pending" tags:"feat" tags_feat:"x" uuid:"06cf70a9-4f0e-4b32-b7bb-d1799803665c"]
|
||||
[description:"fix escaped add: when passing add with escapable characters, bug ensues." entry:"1691774077" modified:"1692954693" priority:"L" status:"pending" tags:"bug" tags_bug:"x" uuid:"79e1ba11-15ae-489f-9868-ab6adea40a91"]
|
||||
[description:"more themes" entry:"1691864624" modified:"1692954684" priority:"L" status:"pending" tags:"themes" tags_themes:"x" uuid:"9ee183d4-3413-4efa-ba68-10d709669c05"]
|
||||
[dep_1a5aab4a-0c2b-444f-9259-6eddc29b9791:"x" depends:"1a5aab4a-0c2b-444f-9259-6eddc29b9791" description:"more themes" entry:"1691864624" modified:"1693548680" priority:"L" status:"pending" tags:"themes" tags_themes:"x" uuid:"9ee183d4-3413-4efa-ba68-10d709669c05"]
|
||||
[description:"colored panels: allow selecting a different swatch for each &open;sub&close;panel" entry:"1692122434" modified:"1692122452" priority:"M" status:"pending" tags:"feat,themes" tags_feat:"x" tags_themes:"x" uuid:"ca17838d-958f-498b-bff5-a24576820ae7"]
|
||||
[description:"semantic colors: allow coloring by values, not just fields." entry:"1692255328" modified:"1692953258" start:"1692953258" status:"pending" tags:"feat,themes" tags_feat:"x" tags_themes:"x" uuid:"1a5aab4a-0c2b-444f-9259-6eddc29b9791"]
|
||||
[description:"hashed color: add a hash&open;color1,rgb123,...&close; color tag allowing to randomly pick a stable color for items like tags" entry:"1693323512" modified:"1693323524" priority:"M" status:"pending" tags:"feat" tags_feat:"x" uuid:"22082221-a02a-4f85-901e-135a99c396c3"]
|
||||
[description:"systematic icons: add a systematic way to insert icons after\/before any field" entry:"1693323578" modified:"1693323578" status:"pending" tags:"feat,themes" tags_feat:"x" tags_themes:"x" uuid:"be1a6eb3-3406-44d1-957a-e952c0d69f2a"]
|
||||
[description:"date pretty print: pretty print date fields" entry:"1693395511" modified:"1693395511" priority:"L" status:"pending" tags:"feat" tags_feat:"x" uuid:"85c7d0dc-4651-4f23-a2ec-9db62937cffd"]
|
||||
[description:"up\/down dirs: display summary of databases further up or down the current one. p:H" entry:"1693423829" modified:"1693423829" status:"pending" tags:"feat" tags_feat:"x" uuid:"fc270e5d-23fd-4824-ad9d-061d624272d9"]
|
||||
[description:"up\/down dirs: display summary of databases further up or down the current one." entry:"1693423835" modified:"1693423835" priority:"H" status:"pending" tags:"feat" tags_feat:"x" uuid:"03998ee8-9917-49cf-a6cb-3fdd14a7deb3"]
|
||||
[description:"up\/down dirs: display summary of databases further up or down the current one." entry:"1693423844" modified:"1693423844" status:"pending" tags:"feat" tags_feat:"x" uuid:"1372c26f-b4e3-45b5-80ca-6d052af8f28e"]
|
||||
[description:"up down dirs: display summary of databases further up or down the current one." entry:"1693423854" modified:"1693423854" status:"pending" tags:"feat" tags_feat:"x" uuid:"16684e35-9eb4-452d-aa68-84ef57309e00"]
|
||||
[description:"visual deps: find an efficient way to show dependencies" entry:"1693510207" modified:"1693510207" status:"pending" tags:"design,feat" tags_design:"x" tags_feat:"x" uuid:"b3bd2bc3-3857-42b9-8168-5e21bcddbec5"]
|
||||
|
|
|
|||
|
|
@ -358,3 +358,33 @@ time 1693475165
|
|||
old [description:"humanize dates: make dates readable to a human being" entry:"1693473644" modified:"1693473656" start:"1693473656" status:"pending" tags:"feat" tags_feat:"x" uuid:"ea4fd6c8-f7d0-4b85-af26-feeb2b196f29"]
|
||||
new [description:"humanize dates: make dates readable to a human being" end:"1693475165" entry:"1693473644" modified:"1693475165" status:"completed" tags:"feat" tags_feat:"x" uuid:"ea4fd6c8-f7d0-4b85-af26-feeb2b196f29"]
|
||||
---
|
||||
time 1693482187
|
||||
old [description:"up\/down dirs: display summary of databases further up or down the current one." entry:"1693423844" modified:"1693423844" status:"pending" tags:"feat" tags_feat:"x" uuid:"1372c26f-b4e3-45b5-80ca-6d052af8f28e"]
|
||||
new [description:"up\/down dirs: display summary of databases further up or down the current one." end:"1693482187" entry:"1693423844" modified:"1693482187" status:"deleted" tags:"feat" tags_feat:"x" uuid:"1372c26f-b4e3-45b5-80ca-6d052af8f28e"]
|
||||
---
|
||||
time 1693482187
|
||||
old [description:"up down dirs: display summary of databases further up or down the current one." entry:"1693423854" modified:"1693423854" status:"pending" tags:"feat" tags_feat:"x" uuid:"16684e35-9eb4-452d-aa68-84ef57309e00"]
|
||||
new [description:"up down dirs: display summary of databases further up or down the current one." end:"1693482187" entry:"1693423854" modified:"1693482187" status:"deleted" tags:"feat" tags_feat:"x" uuid:"16684e35-9eb4-452d-aa68-84ef57309e00"]
|
||||
---
|
||||
time 1693482204
|
||||
old [description:"up\/down dirs: display summary of databases further up or down the current one. p:H" entry:"1693423829" modified:"1693423829" status:"pending" tags:"feat" tags_feat:"x" uuid:"fc270e5d-23fd-4824-ad9d-061d624272d9"]
|
||||
new [description:"up\/down dirs: display summary of databases further up or down the current one. p:H" end:"1693482204" entry:"1693423829" modified:"1693482204" status:"deleted" tags:"feat" tags_feat:"x" uuid:"fc270e5d-23fd-4824-ad9d-061d624272d9"]
|
||||
---
|
||||
time 1693507795
|
||||
new [description:"timezone: handle timezone in date conversion" entry:"1693507795" modified:"1693507795" status:"pending" tags:"bug" tags_bug:"x" uuid:"462b9cae-5fbb-4fcc-ab04-41cbd7a44546"]
|
||||
---
|
||||
time 1693510207
|
||||
new [description:"visual deps: find an efficient way to show dependencies" entry:"1693510207" modified:"1693510207" status:"pending" tags:"design,feat" tags_design:"x" tags_feat:"x" uuid:"b3bd2bc3-3857-42b9-8168-5e21bcddbec5"]
|
||||
---
|
||||
time 1693548680
|
||||
old [description:"more themes" entry:"1691864624" modified:"1692954684" priority:"L" status:"pending" tags:"themes" tags_themes:"x" uuid:"9ee183d4-3413-4efa-ba68-10d709669c05"]
|
||||
new [dep_1a5aab4a-0c2b-444f-9259-6eddc29b9791:"x" depends:"1a5aab4a-0c2b-444f-9259-6eddc29b9791" description:"more themes" entry:"1691864624" modified:"1693548680" priority:"L" status:"pending" tags:"themes" tags_themes:"x" uuid:"9ee183d4-3413-4efa-ba68-10d709669c05"]
|
||||
---
|
||||
time 1693548747
|
||||
old [description:"date pretty print: pretty print date fields" entry:"1693395511" modified:"1693395511" priority:"L" status:"pending" tags:"feat" tags_feat:"x" uuid:"85c7d0dc-4651-4f23-a2ec-9db62937cffd"]
|
||||
new [description:"date pretty print: pretty print date fields" end:"1693548747" entry:"1693395511" modified:"1693548747" priority:"L" status:"completed" tags:"feat" tags_feat:"x" uuid:"85c7d0dc-4651-4f23-a2ec-9db62937cffd"]
|
||||
---
|
||||
time 1693549411
|
||||
old [description:"timezone: handle timezone in date conversion" entry:"1693507795" modified:"1693507795" status:"pending" tags:"bug" tags_bug:"x" uuid:"462b9cae-5fbb-4fcc-ab04-41cbd7a44546"]
|
||||
new [description:"timezone: handle timezone in date conversion" end:"1693549411" entry:"1693507795" modified:"1693549411" status:"completed" tags:"bug" tags_bug:"x" uuid:"462b9cae-5fbb-4fcc-ab04-41cbd7a44546"]
|
||||
---
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import os
|
|||
import re
|
||||
import sys
|
||||
import json
|
||||
import pytz
|
||||
import queue
|
||||
import pathlib
|
||||
import textwrap
|
||||
|
|
@ -72,8 +73,19 @@ class Widget:
|
|||
return rich.text.Text(val, style=self.swatch_of(swatch, val, prefix), end=end)
|
||||
|
||||
def rdate(self, date, swatch, prefix = "color.", end="\n"):
|
||||
# Get current time zone from locale.
|
||||
ltz = str(datetime.datetime.now(datetime.timezone.utc).astimezone().tzinfo)
|
||||
# Ugly hack to bypass a stupid pedantry of pytz.
|
||||
fltz = ltz.replace("CEST", "Europe/Paris")
|
||||
# Get a timezone object.
|
||||
tz = pytz.timezone(fltz)
|
||||
# Convert data to datetime.
|
||||
dt = datetime.datetime.strptime(date, "%Y%m%dT%H%M%SZ")
|
||||
hd = humanize.naturaltime(datetime.datetime.now() - dt)
|
||||
# convert datetime to locale datetime.
|
||||
ldt = tz.localize(dt, is_dst = None)
|
||||
lnow = tz.localize(datetime.datetime.now(), is_dst = None)
|
||||
# Convert delta to human readable.
|
||||
hd = humanize.naturaltime(lnow - ldt)
|
||||
return self.rtext(hd, swatch, prefix, end)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue