Skip to content

Commit

Permalink
Merge pull request #14 from offby1/master
Browse files Browse the repository at this point in the history
created_in_words: use UTC
  • Loading branch information
ergo committed Sep 14, 2015
2 parents c8bdfad + 15600e5 commit 63ccc2e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pyramid_blogr/models/blog_record.py
Expand Up @@ -8,7 +8,7 @@
DateTime #<- time abstraction field,
)
from webhelpers2.text import urlify #<- will generate slugs
from webhelpers2.date import time_ago_in_words #<- human friendly dates
from webhelpers2.date import distance_of_time_in_words #<- human friendly dates

class BlogRecord(Base):
__tablename__ = 'entries'
Expand All @@ -24,4 +24,6 @@ def slug(self):

@property
def created_in_words(self):
return time_ago_in_words(self.created)
# Can't use time_ago_in_words(self.created) since self.created
# is UTC, but that function compares against local time
return distance_of_time_in_words(self.created, datetime.datetime.utcnow())

0 comments on commit 63ccc2e

Please sign in to comment.