From 8fd5a9292c7d3aac352d3c0e96288bff8a79cb47 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Fri, 11 Nov 2022 23:04:43 -0700 Subject: Posting and fan-out both working --- core/ld.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'core') 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) -- cgit v1.2.3