summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2012-12-19 21:53:13 +0100
committerEike Rathke <erack@redhat.com>2012-12-19 21:56:02 +0100
commit3043bfc6248b15836903d6d34c0f8581eebf27e9 (patch)
treed7f1c772ae6887fb839e81976716923436a14af4
parentdc664804675a9d40f5d52946d78451facf5105bc (diff)
resolved fdo#54344 let date pattern match overrule incomplete format match
Change-Id: I69a0c62ab5b4da036a77bd6c3b2baec0af7c8339 (cherry picked from commit 8041285b369e58df477b5e92df4bde68e96056a2)
-rw-r--r--svl/source/numbers/zforfind.cxx12
1 files changed, 11 insertions, 1 deletions
diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index 7e05fe47a167..d5adf88b7555 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -1678,11 +1678,21 @@ input for the following reasons:
{
case 0: // not found
{
- bool bHadExact;
sal_uInt32 nExactDateOrder = (bFormatTurn ?
pFormat->GetExactDateOrder() :
GetDatePatternOrder());
bool bIsExact = (0xff < nExactDateOrder && nExactDateOrder <= 0xffff);
+ if (!bIsExact && bFormatTurn && IsAcceptedDatePattern( nNums[0]))
+ {
+ // If input does not match format but pattern, use pattern
+ // instead, even if eEDF==NF_EVALDATEFORMAT_FORMAT_INTL.
+ // For example, format has "Y-M-D" and pattern is "D.M.",
+ // input with 2 numbers can't match format and 31.12. would
+ // lead to 1931-12-01 (fdo#54344)
+ nExactDateOrder = GetDatePatternOrder();
+ bIsExact = (0xff < nExactDateOrder && nExactDateOrder <= 0xffff);
+ }
+ bool bHadExact;
if (bIsExact)
{
// formatted as date and exactly 2 parts