diff options
-rw-r--r-- | sc/source/core/data/conditio.cxx | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index e02f89e22fb2..2b4fa0c49c56 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -1705,7 +1705,12 @@ bool ScCondDateFormatEntry::IsValid( const ScAddress& rPos ) const } break; case condformat::LASTMONTH: - if( rActDate.GetYear() == aCellDate.GetYear() ) + if( rActDate.GetMonth() == 1 ) + { + if( aCellDate.GetMonth() == 12 && rActDate.GetYear() == aCellDate.GetYear() + 1 ) + return true; + } + else if( rActDate.GetYear() == aCellDate.GetYear() ) { if( rActDate.GetMonth() == aCellDate.GetMonth() + 1) return true; @@ -1719,7 +1724,12 @@ bool ScCondDateFormatEntry::IsValid( const ScAddress& rPos ) const } break; case condformat::NEXTMONTH: - if( rActDate.GetYear() == aCellDate.GetYear() ) + if( rActDate.GetMonth() == 12 ) + { + if( aCellDate.GetMonth() == 1 && rActDate.GetYear() == aCellDate.GetYear() - 1 ) + return true; + } + else if( rActDate.GetYear() == aCellDate.GetYear() ) { if( rActDate.GetMonth() == aCellDate.GetMonth() - 1) return true; |