summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2016-07-08 17:08:47 +0200
committerEike Rathke <erack@redhat.com>2016-07-08 20:41:02 +0000
commit6d4f2dcc7cbba771e9d9b00de50368db4a88ef1b (patch)
tree0301896941b955ffa79ef3e96b874ebdad78662c /basic
parent06287b9c348281612854d67c4eb2e7a38dc722ca (diff)
Resolves: tdf#100452 class Date full (BCE,CE) proleptic Gregorian calendar
... implementing signed years with year 0 gap. Date(31,12,-1) last day BCE Date(1,1,1) first day CE New class Date member functions: * AddYears(sal_Int16) to be used instead of aDate.SetYear(aDate.GetYear()+sal_Int16) to handle year 0 gap. * convenience GetNextYear() to be used insted of GetYear()+1 * convenience GetPrevYear() to be used insted of GetYear()-1 * AddMonths(sal_Int32) * operator=(const css::util::Date&) New class DateTime member functions: * operator=(const css::util::DateTime&) Made some conversion ctors explicit, specifically Date(sal_Int32) Adapted hopefully all places that used a sal_uInt16 year to use sal_Int16 where appropriate. Eliminated some quirks in date handling found on the fly. Added era handling to i18npool icu calendar setting interface, which missing was responsible for 0001-01-01 entered in Calc being set as -0001-01-01, hence subtracting one day resulted in -0002-12-31. Change-Id: I77b39fba9599ebd5067d7864f6c9ebe01f6f578f Reviewed-on: https://gerrit.libreoffice.org/27049 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'basic')
-rw-r--r--basic/source/runtime/methods.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 296af1514bcd..2abca341ca68 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -4858,7 +4858,7 @@ sal_Int16 implGetDateYear( double aDate )
long nDays = (long) aDate;
nDays -= 2; // standardize: 1.1.1900 => 0.0
aRefDate += nDays;
- sal_Int16 nRet = (sal_Int16)( aRefDate.GetYear() );
+ sal_Int16 nRet = aRefDate.GetYear();
return nRet;
}
@@ -4917,7 +4917,7 @@ bool implDateSerial( sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay, double&
{
nYearAdj = ( ( nMonth -12 ) / 12 );
}
- aCurDate.SetYear( aCurDate.GetYear() + nYearAdj );
+ aCurDate.AddYears( nYearAdj );
}
// adjust day value,