Comment.
This commit is contained in:
parent
2d29f46e82
commit
d2c7c9bf2e
@ -8,5 +8,7 @@ register = template.Library()
|
|||||||
@register.filter
|
@register.filter
|
||||||
def hours_since_now(timestamp):
|
def hours_since_now(timestamp):
|
||||||
delta = timezone.now() - timestamp
|
delta = timezone.now() - timestamp
|
||||||
|
# Since a datetime.timedelta only stores the delta in days/seconds/ms
|
||||||
|
# we have to convert the seconds to hours.
|
||||||
return delta.total_seconds() / 3600.0
|
return delta.total_seconds() / 3600.0
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user