mirror of
https://github.com/ansible/awx.git
synced 2026-05-19 23:07:42 -02:30
provide a naive UNTIL= datestamp for schedules for UI convenience
This commit is contained in:
@@ -122,6 +122,17 @@ class Schedule(CommonModel, LaunchTimeConfig):
|
||||
logger.warn('Could not detect valid zoneinfo for {}'.format(self.rrule))
|
||||
return ''
|
||||
|
||||
@property
|
||||
def until(self):
|
||||
# The UNTIL= datestamp (if any) coerced from UTC to the local naive time
|
||||
# of the DTSTART
|
||||
for r in Schedule.rrulestr(self.rrule)._rrule:
|
||||
if r._until:
|
||||
local_until = r._until.astimezone(r._dtstart.tzinfo)
|
||||
naive_until = local_until.replace(tzinfo=None)
|
||||
return naive_until.isoformat()
|
||||
return ''
|
||||
|
||||
@classmethod
|
||||
def coerce_naive_until(cls, rrule):
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user