summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
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)