forked from edward/owl-map
Accept precision=7 (century) for time format
This commit is contained in:
parent
b22d4058fd
commit
fd5829f8d2
|
@ -175,7 +175,10 @@ def format_wikibase_time(v):
|
||||||
p = v["precision"]
|
p = v["precision"]
|
||||||
t = v["time"]
|
t = v["time"]
|
||||||
|
|
||||||
assert p in (9, 10, 11)
|
assert p in (7, 9, 10, 11)
|
||||||
|
|
||||||
|
# TODO: handle dates with century precision (7)
|
||||||
|
# example: https://www.wikidata.org/wiki/Q108266998
|
||||||
|
|
||||||
if p == 11:
|
if p == 11:
|
||||||
return date.fromisoformat(t[1:11]).strftime("%d %B %Y")
|
return date.fromisoformat(t[1:11]).strftime("%d %B %Y")
|
||||||
|
@ -183,3 +186,5 @@ def format_wikibase_time(v):
|
||||||
return date.fromisoformat(t[1:8] + "-01").strftime("%B %Y")
|
return date.fromisoformat(t[1:8] + "-01").strftime("%B %Y")
|
||||||
if p == 9:
|
if p == 9:
|
||||||
return t[1:5]
|
return t[1:5]
|
||||||
|
if p == 7:
|
||||||
|
return t[1:5]
|
||||||
|
|
Loading…
Reference in a new issue