[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - basic/source

Eike Rathke erack at redhat.com
Thu May 4 12:04:58 UTC 2017


 basic/source/runtime/methods.cxx |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

New commits:
commit 134dd332ceaeab43c022cdf3585ca5432cdaa77a
Author: Eike Rathke <erack at redhat.com>
Date:   Wed May 3 16:21:43 2017 +0200

    CDateFromIso: accept YYMMDD for compatibility, tdf#106956 follow-up
    
    It's not ISO but it was accepted before, so continue..
    
    Change-Id: Idd20f8ef9275a0dec71bca79047a8739b580f0eb
    Reviewed-on: https://gerrit.libreoffice.org/37207
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index e3ba6bb64fde..5b230e147c73 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -2063,19 +2063,20 @@ RTLFUNC(CDateFromIso)
         {
             OUString aStr = rPar.Get(1)->GetOUString();
             const sal_Int32 nLen = aStr.getLength();
-            if (nLen != 8 && nLen != 10)
+            if (nLen != 6 && nLen != 8 && nLen != 10)
                 break;
 
             OUString aYearStr, aMonthStr, aDayStr;
-            if (nLen == 8)
+            if (nLen == 6 || nLen == 8)
             {
-                // YYYYMMDD
+                // (YY)YYMMDD
                 if (!comphelper::string::isdigitAsciiString(aStr))
                     break;
 
-                aYearStr  = aStr.copy( 0, 4 );
-                aMonthStr = aStr.copy( 4, 2 );
-                aDayStr   = aStr.copy( 6, 2 );
+                const sal_Int32 nMonthPos = (nLen == 6 ? 2 : 4);
+                aYearStr  = aStr.copy( 0, nMonthPos );
+                aMonthStr = aStr.copy( nMonthPos, 2 );
+                aDayStr   = aStr.copy( nMonthPos + 2, 2 );
             }
             else
             {


More information about the Libreoffice-commits mailing list