summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2019-08-19 19:49:02 +0200
committerEike Rathke <erack@redhat.com>2019-08-19 21:51:38 +0200
commita231922c4cf41a834bdc252e726912699c5e6f7d (patch)
treede09250ae7b00401780491c53366ce242888851c /svl
parentac44308f4df996033444e9d4687746c5d6b9525b (diff)
Related: tdf#72040 select ISO 8601 date+time format if 'T' separator in input
Change-Id: Ia89f791f0a66d0e6d3c3e5ecdd211356f5c2337f Reviewed-on: https://gerrit.libreoffice.org/77752 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
Diffstat (limited to 'svl')
-rw-r--r--svl/source/numbers/zforfind.hxx4
-rw-r--r--svl/source/numbers/zforlist.cxx11
2 files changed, 15 insertions, 0 deletions
diff --git a/svl/source/numbers/zforfind.hxx b/svl/source/numbers/zforfind.hxx
index db19f847c026..1efeb215619b 100644
--- a/svl/source/numbers/zforfind.hxx
+++ b/svl/source/numbers/zforfind.hxx
@@ -68,6 +68,10 @@ public:
void InvalidateDateAcceptancePatterns();
+ /** Whether 'T' separator was detected in an ISO 8601 date+time format.
+ */
+ bool HasIso8601Tsep() const { return bIso8601Tsep; }
+
private:
SvNumberFormatter* pFormatter;
const SvNumberformat* mpFormat; //* The format to compare against, if any
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 5b7aadb8ebd5..6e6934304444 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -1162,6 +1162,17 @@ bool SvNumberFormatter::IsNumberFormat(const OUString& sString,
F_Index = GetStandardFormat( RType, ActLnge );
}
break;
+ case SvNumFormatType::DATETIME :
+ // Preserve ISO 8601 input.
+ if (pStringScanner->HasIso8601Tsep())
+ {
+ F_Index = GetFormatIndex( NF_DATETIME_ISO_YYYYMMDDTHHMMSS, ActLnge );
+ }
+ else
+ {
+ F_Index = GetStandardFormat( RType, ActLnge );
+ }
+ break;
default:
F_Index = GetStandardFormat( RType, ActLnge );
}