Skip to content

Commit

Permalink
don't parse inputs with length 1 as dates #140
Browse files Browse the repository at this point in the history
  • Loading branch information
ThrawnCA committed Aug 17, 2015
1 parent 33f6d7e commit ea7c40e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion messytables/dateparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


def is_date(value):
return date_regex.match(value)
return len(value) != 1 and date_regex.match(value)


def create_date_formats(day_first=True):
Expand Down
5 changes: 5 additions & 0 deletions messytables/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@ class DateUtilType(CellType):
guessing_weight = 3
result_type = datetime.datetime

def test(self, value):
if len(value) == 1:
return False
return CellType.test(self, value)

def cast(self, value):
if value in ('', None):
return None
Expand Down

0 comments on commit ea7c40e

Please sign in to comment.