Commit 9bc3a0db authored by Thimo Kraemer's avatar Thimo Kraemer

More restrictive ISO8601 parser

parent 49b6d010
/*
* KSS-RPC v0.25-beta
* KSS-RPC v0.26-beta
*
* Copyright (c) 2017, joonis new media
* Author: Thimo Kraemer <thimo.kraemer@joonis.de>
......@@ -61,7 +61,7 @@
******************************************************************************************/
var kss = {
version: '0.25-beta',
version: '0.26-beta',
_initialized: false,
_ruleSheets: {},
_nodeRegister: {},
......@@ -358,8 +358,8 @@ kss.ISO8601toDate = function(date) {
// before falling back to any implementation-specific date parsing, so that's what we do, even if native
// implementations could be faster
var s;
// 1 YYYY 2 MM 3 DD 4 HH 5 mm 6 ss 7 msec 8 Z 9 ± 10 tzHH 11 tzmm
if ((s = /^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/.exec(date))) {
// 1 YYYY 2 MM 3 DD 4 HH 5 mm 6 ss 7 msec 8 Z 9 ± 10 tzHH 11 tzmm
if ((s = /^(\d{4}|[+\-]\d{6})-(\d{2})-(\d{2})(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/.exec(date))) {
// avoid NaN timestamps caused by undefined values being passed to Date.UTC
var numericKeys = [ 1, 4, 5, 6, 7, 10, 11 ];
for (var i = 0, k; (k = numericKeys[i]); ++i) {
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment