diff options
author | Eike Rathke <erack@redhat.com> | 2022-09-26 22:52:02 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2022-09-27 00:33:39 +0200 |
commit | 0d3dd0aa54ad792f91d0905f3d46c13df3512d89 (patch) | |
tree | 93a36b8301266d2fe2f21f73554d73987948957f /svl/source/numbers | |
parent | 55219f771cd4e255a079cb4272f640807c805e0f (diff) |
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 <erack@redhat.com>
Tested-by: Jenkins
Diffstat (limited to 'svl/source/numbers')
-rw-r--r-- | svl/source/numbers/zforfind.cxx | 16 |
1 files changed, 9 insertions, 7 deletions
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()) |