# What this PR does
If an OnCall template needs to contain a date relative to a date in the
alert response, currently there is no way for the template to add or
subtract time from a parsed date.
This PR adds a function that allows a time-window (e.g., 1s, 5m, 6h, 7d,
2w) to be converted into a Python timedelta, which can then be added or
subtracted from a datetime. An example usage might be:
```
{% set delta = alert.timeWindow | timedeltaparse %}
{% set time = alert.startsAt | iso8601_to_time - delta | datetimeformat('%s') %}
```
## Checklist
- [X] Unit, integration, and e2e (if applicable) tests updated
- [X] Documentation added (or `pr:no public docs` PR label added if not
required)
- [X] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will show up in the
autogenerated release notes.
|
||
|---|---|---|
| .. | ||
| __init__.py | ||
| test_apply_jinja_template.py | ||
| test_cache.py | ||
| test_create_engine_url.py | ||
| test_custom_fields.py | ||
| test_database.py | ||
| test_l10n.py | ||
| test_markup.py | ||
| test_ordered_model.py | ||
| test_recaptcha.py | ||
| test_regex_replace.py | ||
| test_task_queue_assignment.py | ||
| test_timezones.py | ||
| test_urlize.py | ||
| test_viewset_actions.py | ||