How to compare two dates using cloud function

I realized that the Date Range widget is not working on Telegram.
Therefore, I had two separate date inputs for start date and end date without the date widget.
How can we use a cloud function to validate the date input from the user so that:

  1. The start date is a future date
  2. The end date is greater than the start date.

I tried to look for an example on how to access a Journey’s variable from the documentation but to no avail.

1 Like

You can access variables in the cloud function using data.variables.variableName as shown in the docs

Moreover, you can create date datatype variables using Date.parse methods and compare two different dates