From: Claudio Cambra Date: Tue, 8 Aug 2023 09:27:11 +0000 (+0800) Subject: Customise locale default date format to ensure we eliminate issues parsing two-digit... X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~9^2~7^2~12 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=48c49fca60da46c8066e7e8dc8e202b055ff665b;p=nextcloud-desktop.git Customise locale default date format to ensure we eliminate issues parsing two-digit year strings Signed-off-by: Claudio Cambra --- diff --git a/src/gui/filedetails/datefieldbackend.cpp b/src/gui/filedetails/datefieldbackend.cpp index 0764ac2e1..8377afad9 100644 --- a/src/gui/filedetails/datefieldbackend.cpp +++ b/src/gui/filedetails/datefieldbackend.cpp @@ -15,12 +15,28 @@ #include "datefieldbackend.h" #include +#include namespace OCC { namespace Quick { +DateFieldBackend::DateFieldBackend(QObject *const parent) + : QObject(parent) +{ + // 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); + // Check for specifically two y's, no more and no fewer, within format date + const QRegularExpression re("(?