Skip to content
Browse files

Fixed date range without spaces around '/'.

  • Loading branch information...
1 parent 01f43ac commit 194ec6c3b0b66edf216b7db43e7b615f6417763b @szymonlipinski szymonlipinski committed Mar 14, 2013
Showing with 3 additions and 2 deletions.
  1. +2 −2 lib/akamod/enrich-date.py
  2. +1 −0 test/test_enrich_date.py
View
4 lib/akamod/enrich-date.py
@@ -29,8 +29,8 @@
DEFAULT_DATETIME_SECS = 32503680000.0 # UTC seconds for "3000-01-01"
-DATE_RANGE_RE = r'(\S+)\s*-\s*(\S+)'
-DATE_RANGE_EXT_RE = r'(\S+)\s*[-/]\s*(\S+)'
+DATE_RANGE_RE = r'([0-9-]+)\s*-\s*([0-9-]+)'
+DATE_RANGE_EXT_RE = r'([0-9-]+)\s*[-/]\s*([0-9-]+)'
def split_date(d):
reg = DATE_RANGE_EXT_RE
if len(d.split("/")) == 3: #so th date is like "2001 / 01 / 01"
View
1 test/test_enrich_date.py
@@ -263,6 +263,7 @@ def test_range_with_brackets():
("[ 1960-05-01 - 1960-05-15 ]", "1960-05-01 - 1960-05-15"),
("[1960-05-01 - 1960-05-15]", "1960-05-01 - 1960-05-15"),
("[1960-05-01 / 1960-05-15]", "1960-05-01 / 1960-05-15"),
+ ("[1960-05-01/1960-05-15]", "1960-05-01/1960-05-15"),
]
for r in ranges:

0 comments on commit 194ec6c

Please sign in to comment.
Something went wrong with that request. Please try again.