Date validation


I have an intent where a date range is required. I am trying to add a validation rule for the endDate so that it only accepts a value greater than startDate.

How can I set this rule in Alexa console? All I get is the option to set a static value. How can I tell alexa so that it compares with my startDate slot value?

If it is not possible from the console, can I do it in code? Can reprompt be an option?

Please suggest.


Not sure how this works with the Dialog Interface, but the AMAZON.Date slot is discusse in this thread:


Yes, I would save the startdate as session variable, extract it for validation via moment.js and use their compare methods.


Thank you. I tried the following approach but getting

There was a problem with the requested skill’s response

async ActivityIntent() {
    const startDate = this.$session.$data.sessionStartDate !== undefined ? this.$session.$data.sessionStartDate :  this.$inputs.startDate.value;
    const endDate = this.$session.$data.sessionEndDate !== undefined ? this.$session.$data.sessionEndDate : this.$inputs.endDate.value; // I intentionally put an earlier date here to test.
    const tf = moment(startDate).isBefore(endDate);

    if(!tf) {
        this.$session.$data.sessionStartDate = startDate;
        this.$session.$data.sourceIntentName = "ActivityIntent";
        return this.toIntent("DateValidatorIntent");
    } else {
        // go on with the actual logic.

async DateValidatorIntent() {
    const newEndDate = this.$inputs.reEnterEndDate.value;
    this.$session.$data.sessionEndDate = newEndDate;

    const sourceIntent = this.$session.$data.sourceIntentName;

    return this.toIntent(sourceIntent);

Please tell me what I am doing wrong!


I think the best way to debug here is to log some of the values and see if there is any error happening somewhere


@jan console.log is not revealing anything. The only thing I have understood so far is whenever I am using return this.toIntent('ActivityIntent'), i.e. trying to navigate back to ActivityIntent from DateValidatorIntent, the error is coming up.

I also used a catch block like this in DateValidatorIntent intent:


with this expectation that it would tell me what exactly is happening. But all I am getting is that good old message “Problem in requested skill’s response”.


Hi @emfluenceindia , could you please log some data and post the result here? For example startDate, endDate, tf and newEndDate. Is it possible that your logic creates an infinite loop?