My content type has a field, "hours", which describes how long an item shall be "available"
So, if object.modified() is yesterday (12:00) and "hours" is set to 30, it should show: remaining: 6 hours (today at 12:00)
If hours was set to 54, it would be nice if it could show: Remaining 1 day, 6 hours.
I tried the following code and I am a bit confused (tid is name of hours field)
def get_time(self): modified = self.modified().asdatetime() now = datetime.datetime.now() tid = timedelta( hours = self.tid ) done = modified + tid return done.replace(tzinfo=utc) - now.replace(tzinfo=utc)
In my template, item/get_time actually renders as:
1 days, 6:06:34.438550
Any suggestion on how to get this to look prettier ?