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,10 +2054,14 @@ 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)?
{
if (nPos < rString.getLength()) // Jan1 without separator is not a date
{
eScannedType = NUMBERFORMAT_DATE; // !!! it IS a date !!!
nMonth = nTempMonth;
nMonthPos = 1; // month at the beginning
if ( nMonth < 0 )
{
......@@ -2066,6 +2070,11 @@ bool ImpSvNumberInputScan::ScanStartString( const OUString& rString,
SkipBlanks(rString, nPos);
}
else
{
nPos = nMonthStart; // rewind month
}
}
else
{
int nDayOfWeek = GetDayOfWeek( rString, nPos );
if ( nDayOfWeek )
......@@ -2089,9 +2098,12 @@ 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)?
{
if (nPos < rString.getLength()) // Jan1 without separator is not a date
{
nMonth = nTempMonth;
nMonthPos = 1; // month a the beginning
if ( nMonth < 0 )
{
......@@ -2099,6 +2111,11 @@ bool ImpSvNumberInputScan::ScanStartString( const OUString& rString,
}
SkipBlanks(rString, nPos);
}
else
{
nPos = nMonthStart; // rewind month
}
}
}
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,6 +2312,8 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString,
{
return MatchedReturn();
}
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
......@@ -2304,6 +2324,11 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString,
SkipString( pLoc->getLongDateMonthSep(), rString, nPos );
SkipBlanks(rString, nPos);
}
else
{
nPos = nMonthStart; // rewind month
}
}
if ( SkipChar('E', rString, nPos) || // 10E, 10e, 10,Ee
SkipChar('e', rString, nPos) )
......@@ -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,6 +2668,8 @@ bool ImpSvNumberInputScan::ScanEndString( const OUString& rString,
{
return MatchedReturn();
}
if (nMonthStart > 0) // 10Jan without separator is not a date
{
eScannedType = NUMBERFORMAT_DATE;
nMonth = nTempMonth;
nMonthPos = 3; // month at end
......@@ -2651,6 +2679,11 @@ bool ImpSvNumberInputScan::ScanEndString( const OUString& rString,
}
SkipBlanks(rString, nPos);
}
else
{
nPos = nMonthStart; // rewind month
}
}
sal_Int32 nOrigPos = nPos;
if (GetTimeAmPm(rString, 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