Use DateTime(css::util::DateTime&) ctor

Individual fragments set in the given order even raised SAL_WARN
about non-existing year 0 ...

Change-Id: Iadfc648423b9fc7ec1a9ebfbc05a1ea814078ac2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132742
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
This commit is contained in:
Eike Rathke
2022-04-08 21:56:54 +02:00
parent 7cc4b06fc4
commit 1c49b67731

View File

@@ -213,14 +213,7 @@ bool SwDateTimeField::PutValue( const uno::Any& rVal, sal_uInt16 nWhichId )
util::DateTime aDateTimeValue;
if(!(rVal >>= aDateTimeValue))
return false;
DateTime aDateTime( DateTime::EMPTY );
aDateTime.SetNanoSec(aDateTimeValue.NanoSeconds);
aDateTime.SetSec(aDateTimeValue.Seconds);
aDateTime.SetMin(aDateTimeValue.Minutes);
aDateTime.SetHour(aDateTimeValue.Hours);
aDateTime.SetDay(aDateTimeValue.Day);
aDateTime.SetMonth(aDateTimeValue.Month);
aDateTime.SetYear(aDateTimeValue.Year);
DateTime aDateTime(aDateTimeValue);
SetDateTime(aDateTime);
}
break;