From 32cea091b83cf7e65186aaf8f4d6330ca2554af5 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Tue, 8 Aug 2023 18:48:35 +0800 Subject: [PATCH] Ensure leading zero dates are also correctly parsed Signed-off-by: Claudio Cambra --- src/gui/filedetails/datefieldbackend.cpp | 28 +++++++++++++++++++----- src/gui/filedetails/datefieldbackend.h | 1 + 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/gui/filedetails/datefieldbackend.cpp b/src/gui/filedetails/datefieldbackend.cpp index 6c04369780..89556c8cc3 100644 --- a/src/gui/filedetails/datefieldbackend.cpp +++ b/src/gui/filedetails/datefieldbackend.cpp @@ -25,16 +25,29 @@ namespace Quick DateFieldBackend::DateFieldBackend(QObject *const parent) : QObject(parent) { + _dateFormat = QLocale::system().dateFormat(QLocale::ShortFormat); + // Ensure the date format is for a full year. QLocale::ShortFormat often // provides a short year format that is only two years, which is an absolute - // pain to work with -- ensure instead we have the full, unambiguous year - _dateFormat = QLocale::system().dateFormat(QLocale::ShortFormat); + // pain to work with -- ensure instead we have the full, unambiguous year. // Check for specifically two y's, no more and no fewer, within format date - const QRegularExpression re("(?