Skip to content

Commit

Permalink
Merge pull request #141 from ThrawnCA/master
Browse files Browse the repository at this point in the history
Don't parse inputs with length 1 as dates #140
  • Loading branch information
David Read committed Nov 4, 2015
2 parents 411e129 + ea7c40e commit 8df73fa
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 8df73fa

Please sign in to comment.