R Shiny DateRange Input month year only

后端 未结 2 526
不思量自难忘°
不思量自难忘° 2021-01-04 09:12

Is there a way to Hack or Create a dateRangeInput() selector in Shiny so that it selects only month-year (no day) or that it automatically selects the first day

2条回答
  •  感情败类
    2021-01-04 09:28

    I've just used airDatePicker() to do this. You can edit the minimum view of the popup calendar to "month" and select the date format as "yyyy-mm".

    airDatepickerInput("input_var_name",
                       label = "Start month",
                       value = "2015-10-01",
                       maxDate = "2016-08-01",
                       minDate = "2015-08-01",
                       view = "months", #editing what the popup calendar shows when it opens
                       minView = "months", #making it not possible to go down to a "days" view and pick the wrong date
                       dateFormat = "yyyy-mm"
                       )
    

    The version I've just been working on looks like this (greyed may is where cursor was hovering when I took the screenshot):

提交回复
热议问题