Expand my Community achievements bar.

SOLVED

Is there way to grey out some dates from AEM forms datepicker

Avatar

Level 1

I am trying to disable/grey out public holidays and weekends in AEM forms datepicker. I am trying to add the code on the initialize method. Any snippets

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@harshv7973321 : I think, this cannot be achieve through AEM datepicker component. 

<input type="date" id="${guideid}${"_widget"}" name="${guide:encodeForHtmlAttr(guideField.name,xssAPI)}"
value="${guide:encodeForHtmlAttr(guideField.value,xssAPI)}" style="${guide:encodeForHtmlAttr(guideField.widgetInlineStyles,xssAPI)}"
min="${guide:encodeForHtmlAttr(guideField.minimumDate,xssAPI)}"
max="${guide:encodeForHtmlAttr(guideField.maximumDate,xssAPI)}"/>

 

we can pass only  min and max . 

If you still need to achieve , then you can try to implement customized datepicker for your use case.

 

Thanks,

Siva

Thanks,
Siva

View solution in original post

2 Replies

Avatar

Employee Advisor

@harshv7973321 

I haven't tried this and don't have a reference implementation. Still, you can use moment.js as the client library[0] and make the necessary changes[1] for specific dates by defining an Array containing dates and using this Array to decide whether or not to disable dates.

 

[0] - https://forms.life/2020/06/10/adaptive-forms-date-techniques-with-moment-js/ 

[1] - https://stackoverflow.com/questions/49818429/how-to-disable-the-selected-and-previous-date-in-moment... 

Avatar

Correct answer by
Community Advisor

@harshv7973321 : I think, this cannot be achieve through AEM datepicker component. 

<input type="date" id="${guideid}${"_widget"}" name="${guide:encodeForHtmlAttr(guideField.name,xssAPI)}"
value="${guide:encodeForHtmlAttr(guideField.value,xssAPI)}" style="${guide:encodeForHtmlAttr(guideField.widgetInlineStyles,xssAPI)}"
min="${guide:encodeForHtmlAttr(guideField.minimumDate,xssAPI)}"
max="${guide:encodeForHtmlAttr(guideField.maximumDate,xssAPI)}"/>

 

we can pass only  min and max . 

If you still need to achieve , then you can try to implement customized datepicker for your use case.

 

Thanks,

Siva

Thanks,
Siva