[Libreoffice-commits] core.git: svl/source

Eike Rathke (via logerrit) logerrit at kemper.freedesktop.org
Sun Aug 8 14:45:00 UTC 2021


 svl/source/numbers/zformat.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 5e69c5fbdb44cd782080e7f4d9ad89dc48b2d1b1
Author:     Eike Rathke <erack at redhat.com>
AuthorDate: Sun Aug 8 15:42:19 2021 +0200
Commit:     Eike Rathke <erack at redhat.com>
CommitDate: Sun Aug 8 16:44:25 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 <erack at redhat.com>
    Tested-by: Jenkins

diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 6cedc976c74c..6b68e79f1517 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -3835,7 +3835,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
@@ -4200,7 +4200,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


More information about the Libreoffice-commits mailing list