svl/source/numbers/zformat.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
New commits: commit 1db5e59aa2fcccb070388c2b817737caa17ed4f0 Author: Eike Rathke <[email protected]> AuthorDate: Sun Aug 8 15:42:19 2021 +0200 Commit: Xisco Fauli <[email protected]> CommitDate: Mon Aug 9 17:48:58 2021 +0200 Year without leading 0 if era code is also used YYYY GG or GG YYYY shall display 1 BC not 0001 BC, or AD 1 not AD 0001 Change-Id: I1955f55d37a4af5075c9cfc20c3ea200ba340765 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120174 Reviewed-by: Eike Rathke <[email protected]> Tested-by: Jenkins (cherry picked from commit 5e69c5fbdb44cd782080e7f4d9ad89dc48b2d1b1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120133 Reviewed-by: Mike Kaganski <[email protected]> Reviewed-by: Xisco Fauli <[email protected]> diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index d14bf73841ee..255bfb09b5f7 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -3834,7 +3834,7 @@ bool SvNumberformat::ImpGetDateOutput(double fNumber, sBuff.append('-'); } aStr = rCal.getDisplayString( CalendarDisplayCode::LONG_YEAR, nNatNum ); - if (aStr.getLength() < 4) + if (aStr.getLength() < 4 && !lcl_hasEra(NumFor[nIx])) { using namespace comphelper::string; // Ensure that year consists of at least 4 digits, so it @@ -4199,7 +4199,7 @@ bool SvNumberformat::ImpGetDateTimeOutput(double fNumber, sBuff.append('-'); } aYear = rCal.getDisplayString( CalendarDisplayCode::LONG_YEAR, nNatNum ); - if (aYear.getLength() < 4) + if (aYear.getLength() < 4 && !lcl_hasEra(NumFor[nIx])) { using namespace comphelper::string; // Ensure that year consists of at least 4 digits, so it
