orange-orm 4.4.0-beta.1 → 4.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,12 @@
1
- var pattern = /(\d{4}-[01]\d-[0-3]\d(T| )[0-2]\d:[0-5]\d:[0-5]\d\.\d+)|(\d{4}-[01]\d-[0-3]\d(T| )[0-2]\d:[0-5]\d:[0-5]\d)|(\d{4}-[01]\d-[0-3]\d(T| )[0-2]\d:[0-5]\d)/;
1
+ var patternWithTime = /(\d{4}-[01]\d-[0-3]\d(T| )[0-2]\d:[0-5]\d:[0-5]\d\.\d+)|(\d{4}-[01]\d-[0-3]\d(T| )[0-2]\d:[0-5]\d:[0-5]\d)|(\d{4}-[01]\d-[0-3]\d(T| )[0-2]\d:[0-5]\d)/;
2
+ var patternDateOnly = /^\d{4}-[01]\d-[0-3]\d$/;
2
3
 
3
4
  function tryParseISO(iso) {
4
- if (pattern.test(iso))
5
+ if (patternWithTime.test(iso) || patternDateOnly.test(iso)) {
5
6
  return iso;
6
- else
7
- throw new TypeError(iso + ' is not a valid Date');
8
-
9
-
10
-
11
-
7
+ } else {
8
+ throw new TypeError(iso + ' is not a valid Date');
9
+ }
12
10
  }
13
11
 
14
12
  module.exports = tryParseISO;