Skip to content

Commit

Permalink
fix: activity date type (ZBS)
Browse files Browse the repository at this point in the history
  • Loading branch information
drfho committed Mar 7, 2024
1 parent 0e5f7f8 commit 9f6365f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Products/zms/_objattrs.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,13 +691,19 @@ def isActive(self, REQUEST):
# Start time.
elif key == 'attr_active_start':
if value is not None:
if isinstance(value, time.struct_time):
# Convert time.struct_time to datetime tuple.
value = tuple(value[:8]) + (0,)
dt = datetime.datetime.fromtimestamp(time.mktime(value))
b = b and now > dt
if dt > now and self.REQUEST.get('ZMS_CACHE_EXPIRE_DATETIME', dt) >= dt:
self.REQUEST.set('ZMS_CACHE_EXPIRE_DATETIME',dt)
# End time.
elif key == 'attr_active_end':
if value is not None:
if isinstance(value, time.struct_time):
# Convert time.struct_time to datetime tuple.
value = tuple(value[:8]) + (0,)
dt = datetime.datetime.fromtimestamp(time.mktime(value))
b = b and dt > now
if dt > now and self.REQUEST.get('ZMS_CACHE_EXPIRE_DATETIME', dt) >= dt:
Expand Down

0 comments on commit 9f6365f

Please sign in to comment.