diff --git a/libzim/libzim.pyx b/libzim/libzim.pyx index 9ab6ebb..0eb43c6 100644 --- a/libzim/libzim.pyx +++ b/libzim/libzim.pyx @@ -573,11 +573,9 @@ class Creator(_Creator): return super().config_compression(compression) def add_metadata( - self, name: str, content: Union[str, bytes, datetime.date, datetime.datetime], + self, name: str, content: Union[str, bytes], mimetype: str = "text/plain;charset=UTF-8" ): - if name == "Date" and isinstance(content, (datetime.date, datetime.datetime)): - content = content.strftime("%Y-%m-%d").encode("UTF-8") if isinstance(content, str): content = content.encode("UTF-8") super().add_metadata(name=name, content=content, mimetype=mimetype) diff --git a/tests/test_libzim_creator.py b/tests/test_libzim_creator.py index f39dacb..4ef06bd 100644 --- a/tests/test_libzim_creator.py +++ b/tests/test_libzim_creator.py @@ -1,7 +1,6 @@ #!/usr/bin/env python import base64 -import datetime import itertools import os import pathlib @@ -400,13 +399,8 @@ def test_creator_metadata(fpath, lipsum_item): with Creator(fpath) as c: c.add_item(lipsum_item) for name, value in metadata.items(): - if name == "Date": - continue c.add_metadata(name, value) - mdate = datetime.date(*[int(x) for x in metadata.get("Date").split("-")]) - c.add_metadata("Date", mdate) - zim = Archive(fpath) for name, value in metadata.items(): assert zim.get_metadata(name).decode("UTF-8") == value