diff options
-rw-r--r-- | svl/source/numbers/zforscan.cxx | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx index 0b2fe7ecca28..2e9b7e3d2b57 100644 --- a/svl/source/numbers/zforscan.cxx +++ b/svl/source/numbers/zforscan.cxx @@ -2987,7 +2987,11 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString ) switch (pLoc->getDateOrder()) { case DateOrder::MDY: - if (IsDateFragment( nDayPos, nMonthPos)) + // Convert only if the actual format is not of YDM + // order (which would be a completely unusual order + // anyway, but..), e.g. YYYY.DD.MM not to + // YYYY/MM/DD + if (IsDateFragment( nDayPos, nMonthPos) && !IsDateFragment( nYearPos, nDayPos)) SwapArrayElements( nDayPos, nMonthPos); break; case DateOrder::YMD: @@ -3010,7 +3014,10 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString ) switch (pLoc->getDateOrder()) { case DateOrder::DMY: - if (IsDateFragment( nMonthPos, nDayPos)) + // Convert only if the actual format is not of YMD + // order, e.g. YYYY/MM/DD not to YYYY.DD.MM + /* TODO: convert such to DD.MM.YYYY instead? */ + if (IsDateFragment( nMonthPos, nDayPos) && !IsDateFragment( nYearPos, nMonthPos)) SwapArrayElements( nMonthPos, nDayPos); break; case DateOrder::YMD: |