summaryrefslogtreecommitdiff
path: root/svl/source
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2022-07-14 13:55:15 +0200
committerEike Rathke <erack@redhat.com>2022-07-14 16:31:41 +0200
commitff1c5fedc96456a6be12e7e4fd2109ef5beb45c7 (patch)
treead221e11a190b89ff21cba3a8f111e5ad910687d /svl/source
parent95706c680c509016b8cd60c026d820c7d4575a12 (diff)
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 <erack@redhat.com> Tested-by: Jenkins
Diffstat (limited to 'svl/source')
-rw-r--r--svl/source/numbers/zforfind.cxx20
1 files changed, 13 insertions, 7 deletions
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;