[Libreoffice-commits] core.git: 2 commits - svl/qa svl/source
Eike Rathke
erack at redhat.com
Mon Oct 2 15:36:55 UTC 2017
svl/qa/unit/svl.cxx | 11 ++++++++++-
svl/source/numbers/zforfind.cxx | 8 ++++++++
2 files changed, 18 insertions(+), 1 deletion(-)
New commits:
commit 5478d5d851721f041701dbe0bdd4d2f626fcf6c0
Author: Eike Rathke <erack at redhat.com>
Date: Mon Oct 2 17:35:59 2017 +0200
Add unit tests for ISO 8601 date+time input
Change-Id: Iab53f39313c1bac04fe5718823455e5ef0e52f13
diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx
index 4cd89b0a95a4..97726d52823b 100644
--- a/svl/qa/unit/svl.cxx
+++ b/svl/qa/unit/svl.cxx
@@ -1101,7 +1101,16 @@ void Test::testIsNumberFormat()
{ "5-12-14", false },
{ "005-12-14", true },
{ "15-10-30", true },
- { "2015-10-30", true }
+ { "2015-10-30", true },
+ { "1999-11-23T12:34:56", true },
+ { "1999-11-23 12:34:56", true },
+ { "1999-11-23T12:34:56.789", true },
+ { "1999-11-23T12:34:56,789", true }, // ISO 8601 defines both dot and comma as fractional separator
+ { "1999-11-23 12:34:56.789", true },
+ { "1999-11-23 12:34:56,789", false }, // comma not in en-US if 'T' separator is not present,
+ // debatable, 'T' "may be omitted by mutual consent of those
+ // interchanging data, if ambiguity can be avoided."
+ { "1999-11-23T12:34:56/789", false }
};
for (size_t i = 0; i < SAL_N_ELEMENTS(aTests); ++i)
commit 9b14d2ca8f0c11feb991142e1a0da819aa0e5c38
Author: Eike Rathke <erack at redhat.com>
Date: Mon Oct 2 17:21:59 2017 +0200
Number scanner: accept fractional seconds in ISO 8601 also for ',' comma
... if comma is the group separator (or some other separator).
Strictly only if 'T' separator was encountered.
Change-Id: I4df55235a6a416f0719752dfcde659d846ac208e
diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index 14a027efa64a..c051dd5d9053 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -2353,6 +2353,14 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString,
return MatchedReturn();
}
nDecPos = 2; // . in mid string
+
+ // If this is exactly an ISO 8601 fractional seconds separator, bail
+ // out early to not get confused by later checks for group separator or
+ // other.
+ if (bIso8601Tsep && nPos == rString.getLength() &&
+ eScannedType == css::util::NumberFormat::DATETIME && (rString == "." || rString == ","))
+ return true;
+
SkipBlanks(rString, nPos);
}
More information about the Libreoffice-commits
mailing list