summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorAndrew Godwin2022-11-11 23:04:43 -0700
committerAndrew Godwin2022-11-11 23:04:43 -0700
commit8fd5a9292c7d3aac352d3c0e96288bff8a79cb47 (patch)
tree3a9199c1d35a77d209cf424141fd4aa0e0694118 /core
parentfeb5d9b74fa1e8454eaaf29afae3643c6d7c81f1 (diff)
downloadtakahe-8fd5a9292c7d3aac352d3c0e96288bff8a79cb47.tar.gz
takahe-8fd5a9292c7d3aac352d3c0e96288bff8a79cb47.tar.bz2
takahe-8fd5a9292c7d3aac352d3c0e96288bff8a79cb47.zip
Posting and fan-out both working
Diffstat (limited to 'core')
-rw-r--r--core/ld.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/core/ld.py b/core/ld.py
index 82e2894..8ced9ac 100644
--- a/core/ld.py
+++ b/core/ld.py
@@ -1,3 +1,4 @@
+import datetime
import urllib.parse as urllib_parse
from typing import Dict, List, Union
@@ -273,6 +274,8 @@ schemas = {
},
}
+DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
+
def builtin_document_loader(url: str, options={}):
# Get URL without scheme
@@ -324,3 +327,7 @@ def canonicalise(json_data: Dict, include_security: bool = False) -> Dict:
json_data["@context"] = context
return jsonld.compact(jsonld.expand(json_data), context)
+
+
+def format_date(value: datetime.datetime) -> str:
+ return value.strftime(DATETIME_FORMAT)