diff options
author | Eike Rathke <erack@redhat.com> | 2015-02-20 15:11:36 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2015-03-04 03:12:33 -0800 |
commit | 290df79d3f65b7b1d3d81d0cd81b6e3f31dfd581 (patch) | |
tree | 4269cf80b63d6578c300e7f1543b5721030e822a | |
parent | 9d5591ccd3b1812914d9dd52e872e5efd3a0dc5f (diff) |
Resolves: tdf#89500 catch ISO 8601 datetime in all locales
Change-Id: I906ebdc6aa5c365df98a29e9e0f319f89f6833c6
(cherry picked from commit 5d572e673dec3396487b14bb1f9e86aa8ab86786)
Reviewed-on: https://gerrit.libreoffice.org/14566
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
(cherry picked from commit b5339e73a52c2eb45f5eb4707ee846af4bab99ef)
-rw-r--r-- | svl/source/numbers/zforfind.cxx | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx index 993b71233be4..9bdee3a0ff81 100644 --- a/svl/source/numbers/zforfind.cxx +++ b/svl/source/numbers/zforfind.cxx @@ -2452,16 +2452,35 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString, SkipBlanks( rString, nPos ); } } - else if (nStringPos == 5 && nPos == 0 && rString.getLength() == 1 && - rString[ 0 ] == 'T' && MayBeIso8601()) + else if (nPos == 0 && rString.getLength() == 1 && MayBeIso8601()) { - // ISO 8601 combined date and time, yyyy-mm-ddThh:mm - ++nPos; + if (nStringPos == 5 && rString[0] == 'T') + { + // ISO 8601 combined date and time, yyyy-mm-ddThh:mm + ++nPos; + } + else if (nStringPos == 7 && rString[0] == ':') + { + // ISO 8601 combined date and time, the time part; we reach + // here if the locale's separator is not ':' so it couldn't + // be detected above in the time block. + if (nAnzNums >= 5) + eScannedType = NUMBERFORMAT_DATETIME; + ++nPos; + } } break; -#if NF_RECOGNIZE_ISO8601_TIMEZONES case NUMBERFORMAT_DATETIME: - if (nPos == 0 && rString.getLength() == 1 && nStringPos >= 9 && MayBeIso8601()) + if (nPos == 0 && rString.getLength() == 1 && MayBeIso8601()) + { + if (nStringPos == 9 && rString[0] == ':') + { + // ISO 8601 combined date and time, the time part continued. + ++nPos; + } + } +#if NF_RECOGNIZE_ISO8601_TIMEZONES + else if (nPos == 0 && rString.getLength() == 1 && nStringPos >= 9 && MayBeIso8601()) { // ISO 8601 timezone offset switch (rString[ 0 ]) @@ -2488,8 +2507,8 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString, break; } } - break; #endif + break; } } |