sc/source/filter/xml/xmlcelli.cxx      |    9 ++++++++-
 test/source/sheet/xsheetannotation.cxx |    2 +-
 2 files changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 889fdaad5603d14c8400a98110d4d05a84319192
Author:     Pranam Lashkari <lpra...@collabora.com>
AuthorDate: Thu Aug 15 02:28:19 2024 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Aug 20 16:37:27 2024 +0200

    fixed tdf#162471: display comment time in ods if available
    
    Change-Id: I2fe2621458608a2bf6c382397ec5acdaeffe3748
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171774
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    (cherry picked from commit f684f284deda654893a097b6363bee7ec5b955f5)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172077
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sc/source/filter/xml/xmlcelli.cxx 
b/sc/source/filter/xml/xmlcelli.cxx
index a122075f1c68..ae02df190371 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -919,7 +919,14 @@ void ScXMLTableRowCellContext::SetAnnotation(const 
ScAddress& rPos)
         if (rXMLImport.GetMM100UnitConverter().convertDateTime(fDate, 
mxAnnotationData->maCreateDate))
         {
             SvNumberFormatter* pNumForm = pDoc->GetFormatTable();
-            sal_uInt32 nfIndex = pNumForm->GetFormatIndex( 
NF_DATE_SYS_DDMMYYYY, LANGUAGE_SYSTEM );
+
+            // Date string is in format ISO 8601 inside <dc:date>
+            // i.e: 2024-08-14 or 2024-08-14T23:55:06 or 20240814T235506
+            // Time always has prefix 'T'
+            sal_uInt32 nfIndex = pNumForm->GetFormatIndex(
+                mxAnnotationData->maCreateDate.indexOf('T') > -1 ? 
NF_DATETIME_SYS_DDMMYYYY_HHMMSS
+                                                                 : 
NF_DATE_SYS_DDMMYYYY,
+                LANGUAGE_SYSTEM);
             OUString aDate;
             const Color* pColor = nullptr;
             pNumForm->GetOutputString( fDate, nfIndex, aDate, &pColor );
diff --git a/test/source/sheet/xsheetannotation.cxx 
b/test/source/sheet/xsheetannotation.cxx
index 4846a1a1a4ae..ef039f52c218 100644
--- a/test/source/sheet/xsheetannotation.cxx
+++ b/test/source/sheet/xsheetannotation.cxx
@@ -47,7 +47,7 @@ void XSheetAnnotation::testGetDate()
     uno::Reference< sheet::XSheetAnnotation > aSheetAnnotation (init(), 
UNO_QUERY_THROW);
     OUString aDate = aSheetAnnotation->getDate();
 
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong date", u"01/17/2013"_ustr, aDate);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong date", u"01/17/2013 00:00:00"_ustr, 
aDate);
 }
 void XSheetAnnotation::testGetIsVisible()
 {

Reply via email to