summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/source/filter/xml/xmlcelli.cxx9
-rw-r--r--test/source/sheet/xsheetannotation.cxx2
2 files changed, 9 insertions, 2 deletions
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()
{