Adaptive Card Input.Date

2.5k views Asked by At

How to Set Todays Date as Minimum value in Input.Date Action of Adaptive Card. When a user select date ,all Backdates & Previous dates need to be blocked and he can select only Dates after Today.

I used:-

                        "type": "Input.Date",
                        "label": "Date",
                        "id": "ipDate",
                        "isRequired": true,
                        "errorMessage": "Please enter Date",
                        "separator": true,
                        "min": "LocalTimestamp (Date(YYYY-MM-DD))"

Output But ,It is not Working.

Can anyone Guide what Expression should i use in Min Value???.

I want like this--> enter image description here

2

There are 2 answers

0
bane On

Try utcNow() function.

Here is example, minimal and default date is today. If you need some TimeSpan you can use addDays etc Check: https://learn.microsoft.com/en-us/azure/bot-service/adaptive-expressions/adaptive-expressions-prebuilt-functions?view=azure-bot-service-4.0#date-and-time-functions

{
    "id": "startDate",
    "type": "Input.Date",
    "value": "${substring(utcNow(),0,10)}",
    "min": "${substring(utcNow(),0,10)}",
    "errorMessage": "Date cannot be empty"
},
0
Keerthivasan P On

Add this in the date block of the JSON script.

"min": "@{utcNow()}"

It worked for me.