alexa-skills-kitalexa-slot

Alexa AMAZON.DATE slot default to past dates


I am using the AMAZON.DATE slot and I would like it to default to past dates.

For example, if a user says Monday I would like it to automatically select last Monday rather than next Monday.

In the documentation it confirms that it defaults to 'on or after the current date':

"Utterances that map to a specific date (such as "today", "now", or "november twenty-fifth") convert to a complete date: 2015-11-25. Note that this defaults to dates on or after the current date (see below for more examples)."

For my application there is no way a future date would make sense so it wouldn't be too difficult to manually program this in but I just wondered if there was any other way of doing it?


Solution

  • No, you cannot change the behavior of built in slots, so if Alexa resolves user's answer as a date - before passing it to your further processing just subtract 7 from resolved value. It will give you the date in the past.