diff options
author | Eike Rathke <erack@redhat.com> | 2012-12-19 21:53:13 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-12-21 09:22:25 +0000 |
commit | c796f58d6ea3999268333f6cff687ee517882717 (patch) | |
tree | c7669867504df125eefc16b1519acbd7126cf1a4 /svl | |
parent | fd7a679774088cfbbadcca9434b10f0089fd2a49 (diff) |
resolved fdo#54344 let date pattern match overrule incomplete format match
(cherry picked from commit 8041285b369e58df477b5e92df4bde68e96056a2)
Conflicts:
svl/source/numbers/zforfind.cxx
Change-Id: Ieeba328b1e2a1e0fdcd44ad7899da257f846a6b8
Reviewed-on: https://gerrit.libreoffice.org/1426
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/numbers/zforfind.cxx | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx index 9c4018c783ae..0ccb4b474277 100644 --- a/svl/source/numbers/zforfind.cxx +++ b/svl/source/numbers/zforfind.cxx @@ -1571,11 +1571,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 bHadExact = true; |