From 4efdcda97b11404f45e42788732445af260c915c Mon Sep 17 00:00:00 2001 From: Itai Shirav Date: Thu, 30 Jun 2016 16:12:02 +0300 Subject: [PATCH] Fix bug in date parsing --- src/infi/clickhouse_orm/fields.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/infi/clickhouse_orm/fields.py b/src/infi/clickhouse_orm/fields.py index 20052f9..2829910 100644 --- a/src/infi/clickhouse_orm/fields.py +++ b/src/infi/clickhouse_orm/fields.py @@ -73,7 +73,8 @@ class DateField(Field): if isinstance(value, int): return DateField.class_default + datetime.timedelta(days=value) if isinstance(value, basestring): - # TODO parse '0000-00-00' + if value == '0000-00-00': + return DateField.min_value return datetime.datetime.strptime(value, '%Y-%m-%d').date() raise ValueError('Invalid value for %s - %r' % (self.__class__.__name__, value))