Skip to main content

date

Vasyl MartyniukLess than 1 minute

Syntax

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

Examples

  • (*date)${HTTP_POST.created_at} - prepares DateTime object based on POST data point.
  • (*date)2024-01-01 - prepares DateTime object with January 1st, 2024 UTC date/time.

Definition

Treat the value as a date string. Under the hood, the provided value converts to the DateTimeopen in new window 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"
            }
        }
    }
}
Virtual Assistant