svl/source/numbers/zforfind.cxx |   20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

New commits:
commit ff1c5fedc96456a6be12e7e4fd2109ef5beb45c7
Author:     Eike Rathke <er...@redhat.com>
AuthorDate: Thu Jul 14 13:55:15 2022 +0200
Commit:     Eike Rathke <er...@redhat.com>
CommitDate: Thu Jul 14 16:31:41 2022 +0200

    Let 'MMM D Y H:M' input follow the same date rule as 'MMM D Y'
    
    ... and not only accept for DateOrder::MDY.
    
    Change-Id: Ic17efbdfee5aac1e00d3cee7b14c16875b3dd292
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137076
    Reviewed-by: Eike Rathke <er...@redhat.com>
    Tested-by: Jenkins

diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index 081b3079a2bf..d0ce846b25a7 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -2175,19 +2175,25 @@ input for the following reasons:
                 break;
             }
             case 1:             // month at the beginning (Jan 01 01 8:23)
+            {
                 nCounter = 2;
-                switch (DateFmt)
+                // The input is valid as MDY in almost any
+                // constellation, there is no date order (M)YD except if
+                // set in a format applied.
+                pCal->setValue( CalendarFieldIndex::MONTH, std::abs(nMonth)-1 
);
+                sal_uInt32 nExactDateOrder = (bFormatTurn ? 
mpFormat->GetExactDateOrder() : 0);
+                if ((((nExactDateOrder >> 8) & 0xff) == 'Y') && 
((nExactDateOrder & 0xff) == 'D'))
+                {
+                    pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, 
ImplGetDay(1) );
+                    pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) );
+                }
+                else
                 {
-                case DateOrder::MDY:
                     pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, 
ImplGetDay(0) );
-                    pCal->setValue( CalendarFieldIndex::MONTH, 
std::abs(nMonth)-1 );
                     pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(1) );
-                    break;
-                default:
-                    res = false;
-                    break;
                 }
                 break;
+            }
             case 2:             // month in the middle (10 Jan 94 8:23)
             {
                 nCounter = 2;

Reply via email to