summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-05-03 16:21:43 +0200
committerMichael Stahl <mstahl@redhat.com>2017-05-04 14:04:27 +0200
commit134dd332ceaeab43c022cdf3585ca5432cdaa77a (patch)
tree96f2d0021873d57690e9efa4028f5246717c923d /basic
parentcc6a55d687581db1a174b2a7d01f8a62887b5e24 (diff)
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@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'basic')
-rw-r--r--basic/source/runtime/methods.cxx13
1 files changed, 7 insertions, 6 deletions
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
{