svl/source/numbers/zforfind.cxx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
New commits: commit 0d3dd0aa54ad792f91d0905f3d46c13df3512d89 Author: Eike Rathke <er...@redhat.com> AuthorDate: Mon Sep 26 22:52:02 2022 +0200 Commit: Eike Rathke <er...@redhat.com> CommitDate: Tue Sep 27 00:33:39 2022 +0200 Prevent erroneous fraction detection of not yet accepted date May had happened if the locale's date separator is not '/' but a preset format uses it (for example DD/MM/YYYY) and the locale's date acceptance patterns do not contain D/M/Y so the first '/' did not already lead to a possible date before a match against the format is to be tried. Change-Id: I7f91130da52564496a2b1369741328236dde10e4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140632 Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Jenkins diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx index a30bbf600ef6..56c929e44407 100644 --- a/svl/source/numbers/zforfind.cxx +++ b/svl/source/numbers/zforfind.cxx @@ -2633,15 +2633,17 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString, sal_uInt16 nS if (SkipChar('/', rString, nPos)) // fraction? { if ( eScannedType != SvNumFormatType::UNDEFINED && // already another type - eScannedType != SvNumFormatType::DATE) // except date + eScannedType != SvNumFormatType::DATE) // except date { - return MatchedReturn(); // => jan/31/1994 + return MatchedReturn(); // => jan/31/1994 } - else if (eScannedType != SvNumFormatType::DATE && // analyzed no date until now - ( eSetType == SvNumFormatType::FRACTION || // and preset was fraction - (nNumericsCnt == 3 && // or 3 numbers - (nStringPos == 3 || // and 3rd string particle - (nStringPos == 4 && nSign))))) // or 4th if signed + else if (eScannedType != SvNumFormatType::DATE && // analyzed no date until now + (eSetType == SvNumFormatType::FRACTION || // and preset was fraction + (nNumericsCnt == 3 && // or 3 numbers + (nStringPos == 3 || // and 4th string particle + (nStringPos == 4 && nSign)) && // or 5th if signed + sStrArray[nStringPos-2].indexOf('/') == -1))) // and not 23/11/1999 + // that was not accepted as date yet { SkipBlanks(rString, nPos); if (nPos == rString.getLength())