From bcf7f7e6408872d8315e5c69829d7ce790e4820a Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Wed, 17 Nov 2021 20:27:10 +0100 Subject: Fix QDateTime(QDate) deprecation warnings --- lib/converters.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/converters.h b/lib/converters.h index d9a68bfb..8ec0fa81 100644 --- a/lib/converters.h +++ b/lib/converters.h @@ -146,7 +146,15 @@ struct JsonConverter { template <> struct JsonConverter { - static auto dump(const QDate& val) { return toJson(QDateTime(val)); } + static auto dump(const QDate& val) { + return toJson( +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) + QDateTime(val) +#else + val.startOfDay() +#endif + ); + } static auto load(const QJsonValue& jv) { return fromJson(jv).date(); -- cgit v1.2.3