svl/source/numbers/zforfind.cxx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
New commits: commit e8934a94b44e5ceee790fe5eef86f7a4568a8ed0 Author: Eike Rathke <[email protected]> AuthorDate: Mon Sep 26 22:52:02 2022 +0200 Commit: Michael Stahl <[email protected]> CommitDate: Wed Oct 5 10:35:33 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 <[email protected]> Tested-by: Jenkins (cherry picked from commit 0d3dd0aa54ad792f91d0905f3d46c13df3512d89) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140885 Reviewed-by: Michael Stahl <[email protected]> diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx index 081b3079a2bf..8bf00b3e196b 100644 --- a/svl/source/numbers/zforfind.cxx +++ b/svl/source/numbers/zforfind.cxx @@ -2605,15 +2605,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())
