summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2019-07-12 11:16:07 +0200
committerAndras Timar <andras.timar@collabora.com>2019-08-05 09:55:00 +0200
commitfa0ad0e5ce5ea837c55adf64bd2e85587b099b55 (patch)
treeb1679ccceed335b7c0239f3d36ea091c6aeb3885 /svl
parent986437766b35e800fb9b0cacac6e2555b8f02bc0 (diff)
Resolves: tdf#126342 obtain date particle order from pattern match
... if there was any. In the NF_EVALDATEFORMAT_FORMAT_INTL case the input may match a current locale's pattern instead of a format's locale's pattern and patterns' (format locale + current locale) date orders may be different from the format's date order. Change-Id: I3aeaa6c361f98fe80f69c4f5d975fca892dac6ea Reviewed-on: https://gerrit.libreoffice.org/75481 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins (cherry picked from commit 7de96e9f7b69354fd5b15e1276678000bc386568) Reviewed-on: https://gerrit.libreoffice.org/75491 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 7af89de46ff4a40a8161fd629584d54cfdeadee1) Reviewed-on: https://gerrit.libreoffice.org/76934 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'svl')
-rw-r--r--svl/source/numbers/zforfind.cxx21
1 files changed, 20 insertions, 1 deletions
diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index 0ec1cd812418..dfb66e3de235 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -1699,7 +1699,26 @@ bool ImpSvNumberInputScan::GetDateRef( double& fDays, sal_uInt16& nCounter )
else
{
bFormatTurn = true;
- DateFmt = mpFormat->GetDateOrder();
+ // Even if the format pattern is to be preferred, the input may
+ // have matched a pattern of the current locale, which then
+ // again is to be preferred. Both date orders can be different
+ // so we need to obtain the actual match. For example ISO
+ // YYYY-MM-DD format vs locale's DD.MM.YY input.
+ if (!GetDatePatternOrder())
+ {
+ // No pattern match => format match.
+ DateFmt = mpFormat->GetDateOrder();
+ }
+ else
+ {
+ // Pattern match. Note that patterns may have been
+ // constructed from the format's locale and prepended to
+ // the current locale's patterns, it doesn't necessarily
+ // mean a current locale's pattern was matched, but may if
+ // the format's locale's patterns didn't match, which were
+ // tried first.
+ DateFmt = GetDateOrder();
+ }
}
break;
default: