From a30652295be09afdbba707ce13d0a03e22c4e7a3 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Fri, 26 Jan 2018 11:19:36 +0100 Subject: tdf#108473: don't let empty date in datetime in forms If only an hour is given (so no date part), copy behavior for table and query and put 30/12/99 by default Change-Id: Ifb371758538d2d11bd02b101a347d34816b6fddf Reviewed-on: https://gerrit.libreoffice.org/48665 Reviewed-by: Julien Nabet Tested-by: Jenkins --- forms/source/component/Time.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/forms/source/component/Time.cxx b/forms/source/component/Time.cxx index 3e580c8451c2..ed87e9aa6224 100644 --- a/forms/source/component/Time.cxx +++ b/forms/source/component/Time.cxx @@ -22,6 +22,7 @@ #include #include #include +#include using namespace dbtools; @@ -235,6 +236,8 @@ bool OTimeModel::commitControlValueToDbColumn( bool /*_bPostReset*/ ) else { util::DateTime aDateTime = m_xColumn->getTimestamp(); + if (aDateTime.Year == 0 && aDateTime.Month == 0 && aDateTime.Day == 0) + aDateTime = ::com::sun::star::util::DateTime(0,0,0,0,30,12,1899, false); aDateTime.NanoSeconds = aTime.NanoSeconds; aDateTime.Seconds = aTime.Seconds; aDateTime.Minutes = aTime.Minutes; -- cgit