java-slack-sdk icon indicating copy to clipboard operation
java-slack-sdk copied to clipboard

How to avoid selection of past date in DatePickerElement

Open roman-somyk-sp opened this issue 2 years ago • 5 comments

I'm working with DatePickerElement as an input element and there’s the requirement to restrict the selection of past dates for users. The best example is datepicker in Outlook Calendar bot: image

Is there any chance to make a date selection in java slack sdk as above on the screenshot? Currently I have the following model of DatePickerElement: image

The Slack SDK version

1.25.1

Java Runtime version

openjdk version "11.0.9" 2020-10-20

OS info

ProductName: macOS ProductVersion: 12.5.1 BuildVersion: 21G83

roman-somyk-sp avatar Sep 12 '22 13:09 roman-somyk-sp

Hey @roman-somyk-sp thanks for reaching out and providing the screenshots! 🙇🏻

I agree, the date picker with disabled dates is a better user experience. ➕

Unfortunately, the feature to disable past dates is not publicly available. The Slack-built apps (Google Calendar, Outlook Calendar, etc) are accessing private features that are not yet available to the public. The good news is that I've submitted your feature request internally and I can see that there is a growing amount of votes to release this feature publicly.

The best workaround that I can suggest is to use the view submission to validate the selected date and display an error for the DatePickerElement field. This isn't an ideal user experience, but I hope it can be a temporary workaround until the date picker supports the disabled date range.

mwbrooks avatar Sep 12 '22 19:09 mwbrooks

Hi @mwbrooks! Thanks for the quick response!

Glad to know that this feature could appear soon 😊 Do you have any estimates of when it will be released?

roman-somyk-sp avatar Sep 15 '22 08:09 roman-somyk-sp

Also, I have a question related to view submission validation error (ctx.ackWithErrors()) for optional=false input elements. Is there any possibility of removing this error after the viewUpdate? For now, it validates the newly added required elements after the viewUpdate. E.g:

https://user-images.githubusercontent.com/73991539/190415537-8b8e291d-aad6-4cad-804c-e43333c2ca07.mov

roman-somyk-sp avatar Sep 15 '22 13:09 roman-somyk-sp

@roman-somyk-sp

Do you have any estimates of when it will be released?

We don't have anything that we can share at this moment. To know the progress on that later on, please contact our customer support team via either /feedback or https://my.slack.com/help/requests/new for following up.

Is there any possibility of removing this error after the viewUpdate? For now, it validates the newly added required elements after the viewUpdate.

If you're looking for a way to remove the error indicator before submitting the modal again, unfortunately there is no way to achieve your goal at this point. As a workaround, changing block_id / action_id for the block may help but I know this may not be an ideal solution for you. Hope this helps!

seratch avatar Sep 19 '22 08:09 seratch

Got it! Thank you for your response!

roman-somyk-sp avatar Sep 19 '22 13:09 roman-somyk-sp