How do I select only the dates that exist in my data?

Thanks for your help!

I want to add a date selection input.
Right now I am using dateInput, but I found that it contains all the dates, what I want to achieve is to show only the dates that exist in the date column of my data, I tried to use datesdisabled , but it doesn't seem to work well.

Do you have any ideas? Thank you very much!

Is this the example from here:

Then the disabled dates are the last one.

ui <- fluidPage(
  # Disable specific dates.
  dateInput("date8", "Date:", value = "2012-02-29",
            datesdisabled = c("2012-03-01", "2012-03-02"))

shinyApp(ui, server = function(input, output) { })

Hello, thank you for your answer.

I have tried this method, but it is not possible to put all the dates into datesdisabled.

My purpose is that the dates that can be selected are only the date that exist in my data columns.

for example, I only have 20 date in my data column, so I can't exhaust all the dates in datesdisabled except for the 20 date

Why not?
All you need to do is to define the total used range, and then the allowed dates and the dates to exclude are simply all the possible dates without the allowed ones.

## very trivial example for the range should be realised with true date-ranges!
Jan = paste("2023-01", 1:31, sep = "-")

# define the available dates
available =  c("2023-01-11",
# remove the available ones from the list
not_available = Jan[!Jan %in% available]
 [1] "2023-01-1"  "2023-01-2"  "2023-01-3"  "2023-01-4"  "2023-01-5"  "2023-01-6"  "2023-01-7"  "2023-01-8" 
 [9] "2023-01-9"  "2023-01-10" "2023-01-13" "2023-01-14" "2023-01-16" "2023-01-17" "2023-01-18" "2023-01-19"
[17] "2023-01-20" "2023-01-21" "2023-01-23" "2023-01-24" "2023-01-25" "2023-01-26" "2023-01-29" "2023-01-30"
[25] "2023-01-31"

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.