Use a bit more standard null date
The two places in cellvalueconversion.cxx using the null date were
introduced in commit a7e949673c
(gridfixes: #i117265# use a NumberFormatter for converting cell
values to text., 2012-09-14); they are used together, so that the
code in lcl_convertDateToDays uses the same epoch as defined in
the respective number formatter, and the obtained number value is
only ever used inside convertToString in a call to the formatter's
convertNumberToString. The old value was arbitrary; and the new
value has some optimizations in the code (see Date::DateToDays and
comphelper::date::convertDateToDaysNormalizing called from it).
Change-Id: I9c050d26ace1cf3fccde579d0d91c00f26bb3fd8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190788
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
@@ -60,7 +60,7 @@ namespace
|
||||
double lcl_convertDateToDays(sal_uInt16 const i_day, sal_uInt16 const i_month,
|
||||
sal_Int16 const i_year)
|
||||
{
|
||||
tools::Long const nNullDateDays = ::Date::DateToDays(1, 1, 1900);
|
||||
tools::Long const nNullDateDays = ::Date::DateToDays(30, 12, 1899);
|
||||
tools::Long const nValueDateDays = ::Date::DateToDays(i_day, i_month, i_year);
|
||||
|
||||
return nValueDateDays - nNullDateDays;
|
||||
@@ -280,7 +280,7 @@ bool CellValueConversion::ensureNumberFormatter()
|
||||
= NumberFormatsSupplier::createWithLocale(xContext, aLocale);
|
||||
|
||||
// ensure a NullDate we will assume later on
|
||||
css::util::Date const aNullDate(1, 1, 1900);
|
||||
css::util::Date const aNullDate(30, 12, 1899);
|
||||
Reference<XPropertySet> const xFormatSettings(xSupplier->getNumberFormatSettings(),
|
||||
UNO_SET_THROW);
|
||||
xFormatSettings->setPropertyValue(u"NullDate"_ustr, Any(aNullDate));
|
||||
|
||||
Reference in New Issue
Block a user