Skip to content

Commit

Permalink
added due_date property
Browse files Browse the repository at this point in the history
  • Loading branch information
biern committed May 3, 2015
1 parent 3dfaa8c commit 3ff2cd9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/test_trello.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ def test52_add_card_set_due(self):
card.fetch()
actual_due_date = card.due[:10]
self.assertEquals(expected_due_date, actual_due_date)
# Note that set_due passes only the date, stripping time
self.assertEquals(card.due_date.date(), due_date.date())

def test53_checklist(self):
name = "Testing from Python"
Expand Down
4 changes: 4 additions & 0 deletions trello/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,10 @@ def create_date(self):
date_str = self.actions[0]['date'][:-5]
return datetime.strptime(date_str, '%Y-%m-%dT%H:%M:%S')

@property
def due_date(self):
return dateparser.parse(self.due)

def set_name(self, new_name):
"""
Update the name on the card to :new_name:
Expand Down

0 comments on commit 3ff2cd9

Please sign in to comment.