Input.Date in calendar control not honours max and min
We are developing a bot (c# V4) that is interacting with the webchat but despite we are inserting max and min value they seems to be ignored when the calendar is rendered. Are we facing the issue described here https://github.com/Microsoft/AdaptiveCards/issues/2103 and is specific to the render used in webchat?
thanks
Hi @adalfa, what version of Web Chat are you using? Could you also provide the JSON of your card so we can reproduce this issue?
Web Chat uses the AdaptiveCards npm package to convert AdaptiveCards from JSON to HTML, and it appears the renderer is not properly adding the min and max values to the date input element. Consequently, this is an issue with the AdaptiveCards module and not Web Chat. Notice in the code snippet below that the AdaptiveCard does have min and max for the date input, but the rendered HTML does not.
const AdaptiveCards = require("adaptivecards");
const jsdomInstance = new (require('jsdom')).JSDOM();
global.document = jsdomInstance.window.document;
global.window = jsdomInstance.window;
global.HTMLElement = jsdomInstance.window.HTMLElement;
var card = {
"type": "AdaptiveCard",
"body": [
{
"type": "Input.Date",
"id": "date",
"value": "2019-04-30",
"min": "2019-04-23",
"max": "2019-05-07"
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.1"
};
// Create an AdaptiveCard instance
var adaptiveCard = new AdaptiveCards.AdaptiveCard();
// Parse the card payload
adaptiveCard.parse(card);
const renderedCard = adaptiveCard.render();
console.log(renderedCard.outerHTML);
Output
<div class="ac-container" style="display: flex; flex-direction: column; justify-content: flex-start; background-color: rgb(255, 255, 255); box-sizing: border-box; flex: 0 0 auto; padding: 20px 20px 20px 20px;" tabindex="0">
<input type="date" class="ac-input ac-dateInput" style="width: 100%; box-sizing: border-box; flex: 0 0 auto;">
</div>
I would recommend opening a new issue in the AdaptiveCards Repo.
@adalfa Any updates on this?
it seems merged in commit 0969e21 in https://github.com/microsoft/AdaptiveCards/pull/2810 actually i do not have the chance to give a try
@Naveenbc
tested with tdurnford's code
<div class="ac-container ac-adaptiveCard" style="display: flex; flex-direction: column; justify-content: flex-start; box-sizing: border-box; flex: 0 0 auto; padding: 20px 20px 20px 20px; margin: 0px 0px 0px 0px; background-color: rgb(255, 255, 255);" tabindex="0"><div style="display: flex; flex-direction: column; box-sizing: border-box; flex: 0 0 auto;"><div class="ac-input-container" style="display: flex;"><input type="date" min="2019-04-23" max="2019-05-07" class="ac-input ac-dateInput" style="width: 100%; min-width: 0px;"></div></div></div>
it seems ok now