summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-05-03 16:21:43 +0200
committerAndras Timar <andras.timar@collabora.com>2017-05-07 22:48:16 +0200
commit47e33633582d276fa2eb421582de348b9ebe19c0 (patch)
tree403cf0aeef790b2e272140b6511975401e773489 /basic
parent6eb8d90a8f1d54e3160c60c6db9964b4484378ab (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> (cherry picked from commit 134dd332ceaeab43c022cdf3585ca5432cdaa77a)
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
{