[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - svl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Aug 22 07:33:32 UTC 2018


 svl/source/numbers/zforscan.cxx |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 16ee6373bab9056650cf3b7a153e832d8d09fc28
Author:     Eike Rathke <erack at redhat.com>
AuthorDate: Thu Aug 16 18:00:29 2018 +0200
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Aug 22 09:33:10 2018 +0200

    Do not convert YMD date order to YDM and vice versa, tdf#107012 follow-up
    
    Change-Id: I6362caae4dd0764a5f99f1b0453c17ecde4b53f1
    Reviewed-on: https://gerrit.libreoffice.org/59213
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Jenkins
    (cherry picked from commit a4c9e4539ee82c409add42e68329d4eb1100d62f)
    Reviewed-on: https://gerrit.libreoffice.org/59244
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx
index 0b2fe7ecca28..2e9b7e3d2b57 100644
--- a/svl/source/numbers/zforscan.cxx
+++ b/svl/source/numbers/zforscan.cxx
@@ -2987,7 +2987,11 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
                     switch (pLoc->getDateOrder())
                     {
                         case DateOrder::MDY:
-                            if (IsDateFragment( nDayPos, nMonthPos))
+                            // Convert only if the actual format is not of YDM
+                            // order (which would be a completely unusual order
+                            // anyway, but..), e.g. YYYY.DD.MM not to
+                            // YYYY/MM/DD
+                            if (IsDateFragment( nDayPos, nMonthPos) && !IsDateFragment( nYearPos, nDayPos))
                                 SwapArrayElements( nDayPos, nMonthPos);
                         break;
                         case DateOrder::YMD:
@@ -3010,7 +3014,10 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
                     switch (pLoc->getDateOrder())
                     {
                         case DateOrder::DMY:
-                            if (IsDateFragment( nMonthPos, nDayPos))
+                            // Convert only if the actual format is not of YMD
+                            // order, e.g. YYYY/MM/DD not to YYYY.DD.MM
+                            /* TODO: convert such to DD.MM.YYYY instead? */
+                            if (IsDateFragment( nMonthPos, nDayPos) && !IsDateFragment( nYearPos, nMonthPos))
                                 SwapArrayElements( nMonthPos, nDayPos);
                         break;
                         case DateOrder::YMD:


More information about the Libreoffice-commits mailing list