Files
odfstudio/sax/source
Mike Kaganski 97bc8766e2 tdf#165733: fix leap year detection BCE
lcl_isLeapYear used a simple "is divisible" method to check if a given
year is leap. But that didn't take BCE into account: we use historical
numbering system, where before year 0001 was year -0001; and that year
was leap.

Use comphelper::date::getDaysInMonth for that, which is correct, and
also deduplicates the code. Make sure that years beyond sal_Int16 are
considered an error: they are not representable in css::util::Date,
and comphelper::date::getDaysInMonth takes years as sal_Int16.

Change-Id: I34f1ad4d5d03e05a7cf787f9997b04b1d705b583
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193302
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2025-11-02 18:24:21 +01:00
..