AfterRelativeDate
Checks the given datetime has occured after the provided relative time.
- Type
- python
- Pack
- FiltersAndTransformers
Source
import dateparser
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
def check_date(value, relative_date):
settings = {"TO_TIMEZONE": "UTC", "RETURN_AS_TIMEZONE_AWARE": False}
v = dateparser.parse(value, settings=settings) # type: ignore[arg-type]
da = dateparser.parse(relative_date, settings=settings) # type: ignore[arg-type]
return v > da # type: ignore
def main():
value = demisto.args().get("left")
if isinstance(value, list):
value = demisto.args().get("left")[0]
relative_date = demisto.args().get("right")
return_results(check_date(value, relative_date))
if __name__ in ("__builtin__", "builtins", "__main__"):
main()
README
Checks the given datetime has occurred after the provided relative time.
Script Data
| Name | Description |
|---|---|
| Script Type | python3 |
| Tags | date, filter, Condition |
| Cortex XSOAR Version | 5.0.0 |
Inputs
| Argument Name | Description |
|---|---|
| left | Date value to check - Can be any time format. ex. “2020-01-01T00:00:00” |
| right | Relative time ex. “6 months ago” |
Outputs
There are no outputs for this script.