From e6d7ba06fba27cb2bbdeb06a0411eac38d8b34e4 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Tue, 11 Dec 2018 17:02:02 +0100 Subject: [PATCH] Convert the standard opds date to our format (YYYY-MM-DD) --- src/book.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/book.cpp b/src/book.cpp index 6d41a87eb..02489ac0d 100644 --- a/src/book.cpp +++ b/src/book.cpp @@ -131,6 +131,14 @@ void Book::updateFromXml(const pugi::xml_node& node, const std::string& baseDir) #undef ATTR +static std::string fromOpdsDate(const std::string& date) +{ + //The opds date use the standard --
T::Z + //and we want --
. That's easy, let's take the first 10 char + return date.substr(0, 10); +} + + #define VALUE(name) node.child(name).child_value() void Book::updateFromOpds(const pugi::xml_node& node, const std::string& urlHost) { @@ -141,7 +149,7 @@ void Book::updateFromOpds(const pugi::xml_node& node, const std::string& urlHost m_title = VALUE("title"); m_description = VALUE("description"); m_language = VALUE("language"); - m_date = VALUE("updated"); + m_date = fromOpdsDate(VALUE("updated")); m_creator = node.child("author").child("name").child_value(); for(auto linkNode = node.child("link"); linkNode; linkNode = linkNode.next_sibling("link")) {