Kaydet (Commit) 43624d93 authored tarafından Eike Rathke's avatar Eike Rathke

resolved fdo#34724 Jan1 or 1Jan without separating character is not date

Change-Id: I2cf02a26b81fa634c842df455de669f1c60241bc
üst d2a19aad
......@@ -2054,16 +2054,25 @@ bool ImpSvNumberInputScan::ScanStartString( const OUString& rString,
}
else
{
nMonth = GetMonth(rString, nPos);
if ( nMonth ) // month (Jan 1)?
const sal_Int32 nMonthStart = nPos;
short nTempMonth = GetMonth(rString, nPos);
if ( nTempMonth ) // month (Jan 1)?
{
eScannedType = NUMBERFORMAT_DATE; // !!! it IS a date !!!
nMonthPos = 1; // month at the beginning
if ( nMonth < 0 )
if (nPos < rString.getLength()) // Jan1 without separator is not a date
{
SkipChar( '.', rString, nPos ); // abbreviated
eScannedType = NUMBERFORMAT_DATE; // !!! it IS a date !!!
nMonth = nTempMonth;
nMonthPos = 1; // month at the beginning
if ( nMonth < 0 )
{
SkipChar( '.', rString, nPos ); // abbreviated
}
SkipBlanks(rString, nPos);
}
else
{
nPos = nMonthStart; // rewind month
}
SkipBlanks(rString, nPos);
}
else
{
......@@ -2089,15 +2098,23 @@ bool ImpSvNumberInputScan::ScanStartString( const OUString& rString,
SkipString( pFormatter->GetLocaleData()->getLongDateDayOfWeekSep(), rString, nPos );
}
SkipBlanks(rString, nPos);
nMonth = GetMonth(rString, nPos);
if ( nMonth ) // month (Jan 1)?
nTempMonth = GetMonth(rString, nPos);
if ( nTempMonth ) // month (Jan 1)?
{
nMonthPos = 1; // month a the beginning
if ( nMonth < 0 )
if (nPos < rString.getLength()) // Jan1 without separator is not a date
{
SkipChar( '.', rString, nPos ); // abbreviated
nMonth = nTempMonth;
nMonthPos = 1; // month a the beginning
if ( nMonth < 0 )
{
SkipChar( '.', rString, nPos ); // abbreviated
}
SkipBlanks(rString, nPos);
}
else
{
nPos = nMonthStart; // rewind month
}
SkipBlanks(rString, nPos);
}
}
if (!nMonth)
......@@ -2282,6 +2299,7 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString,
}
}
const sal_Int32 nMonthStart = nPos;
short nTempMonth = GetMonth(rString, nPos); // month in the middle (10 Jan 94)
if (nTempMonth)
{
......@@ -2294,15 +2312,22 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString,
{
return MatchedReturn();
}
eScannedType = NUMBERFORMAT_DATE; // !!! it IS a date
nMonth = nTempMonth;
nMonthPos = 2; // month in the middle
if ( nMonth < 0 )
if (nMonthStart > 0 && nPos < rString.getLength()) // 10Jan or Jan94 without separator are not dates
{
eScannedType = NUMBERFORMAT_DATE; // !!! it IS a date
nMonth = nTempMonth;
nMonthPos = 2; // month in the middle
if ( nMonth < 0 )
{
SkipChar( '.', rString, nPos ); // abbreviated
}
SkipString( pLoc->getLongDateMonthSep(), rString, nPos );
SkipBlanks(rString, nPos);
}
else
{
SkipChar( '.', rString, nPos ); // abbreviated
nPos = nMonthStart; // rewind month
}
SkipString( pLoc->getLongDateMonthSep(), rString, nPos );
SkipBlanks(rString, nPos);
}
if ( SkipChar('E', rString, nPos) || // 10E, 10e, 10,Ee
......@@ -2630,6 +2655,7 @@ bool ImpSvNumberInputScan::ScanEndString( const OUString& rString,
}
}
const sal_Int32 nMonthStart = nPos;
short nTempMonth = GetMonth(rString, nPos); // 10 Jan
if (nTempMonth)
{
......@@ -2642,14 +2668,21 @@ bool ImpSvNumberInputScan::ScanEndString( const OUString& rString,
{
return MatchedReturn();
}
eScannedType = NUMBERFORMAT_DATE;
nMonth = nTempMonth;
nMonthPos = 3; // month at end
if ( nMonth < 0 )
if (nMonthStart > 0) // 10Jan without separator is not a date
{
eScannedType = NUMBERFORMAT_DATE;
nMonth = nTempMonth;
nMonthPos = 3; // month at end
if ( nMonth < 0 )
{
SkipChar( '.', rString, nPos ); // abbreviated
}
SkipBlanks(rString, nPos);
}
else
{
SkipChar( '.', rString, nPos ); // abbreviated
nPos = nMonthStart; // rewind month
}
SkipBlanks(rString, nPos);
}
sal_Int32 nOrigPos = nPos;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment