date

Syntax

(*date)${...}
(*date)<datetime-string>

Examples

Definition

Treat the value as a date string. Under the hood, the provided value converts to the DateTime object with UTC timezone. It defaults to null if the value cannot be successfully converted to a DataTime object.

The following policy checks if current user was registered after February 14th, 2023 date and if so, redirect them to a different location if they are trying to access the page with slug “best-deals-2023”.

{
    "Statement": {
        "Effect": "deny",
        "Resource": "Post:page:best-deals-2023",
        "Action": "Read",
        "Metadata": {
            "Redirect": {
                "Type": "page",
                "Slug": "best-deals-2024"
            }
        },
        "Condition": {
            "Greater": {
                "(*date)${USER.user_registered}": "(*date)2023-02-14"
            }
        }
    }
}