summaryrefslogtreecommitdiff
path: root/tools/source
diff options
context:
space:
mode:
authorAndreas Heinisch <andreas.heinisch@yahoo.de>2021-03-23 10:54:14 +0100
committerEike Rathke <erack@redhat.com>2021-04-04 19:54:49 +0200
commitd78d44bfbf4b1ae7aa68b38fdfc916de47fce05f (patch)
tree3ae5b9baeb155b9c72cc3dadd70f61b0a05d5db8 /tools/source
parent642501ecb94cef11592ecc49b7a13ba5bdbb8d62 (diff)
tdf#58745 - Detect end of month when extending a date list
Change-Id: Icaa64a493598dc4bb8f2d6d076ad4300e2e4dde6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112976 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de> Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113156 Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'tools/source')
-rw-r--r--tools/source/datetime/tdate.cxx11
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/source/datetime/tdate.cxx b/tools/source/datetime/tdate.cxx
index a38fb8e986c3..979611333813 100644
--- a/tools/source/datetime/tdate.cxx
+++ b/tools/source/datetime/tdate.cxx
@@ -452,6 +452,17 @@ bool Date::IsValidDate( sal_uInt16 nDay, sal_uInt16 nMonth, sal_Int16 nYear )
return true;
}
+bool Date::IsEndOfMonth() const
+{
+ return IsEndOfMonth(GetDay(), GetMonth(), GetYear());
+}
+
+//static
+bool Date::IsEndOfMonth(sal_uInt16 nDay, sal_uInt16 nMonth, sal_Int16 nYear)
+{
+ return IsValidDate(nDay, nMonth, nYear) && ImplDaysInMonth(nMonth, nYear) == nDay;
+}
+
void Date::Normalize()
{
sal_uInt16 nDay = GetDay();