From 8041285b369e58df477b5e92df4bde68e96056a2 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Wed, 19 Dec 2012 21:53:13 +0100 Subject: resolved fdo#54344 let date pattern match overrule incomplete format match Change-Id: I69a0c62ab5b4da036a77bd6c3b2baec0af7c8339 --- svl/source/numbers/zforfind.cxx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3