airDatepicker | R Documentation |
An alternative to shiny::dateInput()
to select single, multiple or date range
based on Air Datepicker library.
And two alias to select months or years.
airDatepickerInput(
inputId,
label = NULL,
value = NULL,
multiple = FALSE,
range = FALSE,
timepicker = FALSE,
separator = " - ",
placeholder = NULL,
dateFormat = "yyyy-MM-dd",
firstDay = NULL,
minDate = NULL,
maxDate = NULL,
disabledDates = NULL,
disabledDaysOfWeek = NULL,
highlightedDates = NULL,
view = c("days", "months", "years"),
startView = NULL,
minView = c("days", "months", "years"),
monthsField = c("monthsShort", "months"),
clearButton = FALSE,
todayButton = FALSE,
autoClose = FALSE,
timepickerOpts = timepickerOptions(),
position = NULL,
update_on = c("change", "close"),
onlyTimepicker = FALSE,
toggleSelected = TRUE,
addon = c("right", "left", "none"),
addonAttributes = list(class = "btn-outline-secondary"),
language = "en",
tz = NULL,
inline = FALSE,
readonly = FALSE,
onkeydown = NULL,
width = NULL
)
timepickerOptions(
dateTimeSeparator = NULL,
timeFormat = NULL,
minHours = NULL,
maxHours = NULL,
minMinutes = NULL,
maxMinutes = NULL,
hoursStep = NULL,
minutesStep = NULL
)
airMonthpickerInput(inputId, label = NULL, value = NULL, ...)
airYearpickerInput(inputId, label = NULL, value = NULL, ...)
inputId |
The |
label |
Display label for the control, or |
value |
Initial value(s), dates as character string are accepted in |
multiple |
Select multiple dates. If |
range |
Select a date range. |
timepicker |
Add a timepicker below calendar to select time. |
separator |
Separator between dates when several are selected, default to |
placeholder |
A character string giving the user a hint as to what can be entered into the control. |
dateFormat |
Format to use to display date(s), default to |
firstDay |
Day index from which week will be started. Possible values are from 0 to 6, where 0 - Sunday and 6 - Saturday. By default value is taken from current localization, but if it passed here then it will have higher priority. |
minDate |
The minimum allowed date. Either a Date object, or a string in |
maxDate |
The maximum allowed date. Either a Date object, or a string in |
disabledDates |
A vector of dates to disable, e.g. won't be able to select one of dates passed. |
disabledDaysOfWeek |
Day(s) of week to disable, numbers from 0 (Sunday) to 6 (Saturday). |
highlightedDates |
A vector of dates to highlight. |
view |
Starting view, one of |
startView |
Date shown in calendar when date picker is opened. |
minView |
Minimal view, one of |
monthsField |
Names for the months when view is 'months',
use |
clearButton |
If |
todayButton |
If |
autoClose |
If |
timepickerOpts |
Options for timepicker, see |
position |
Where calendar should appear, a two word string like
|
update_on |
When to send selected value to server: on |
onlyTimepicker |
Display only the time picker. |
toggleSelected |
When |
addon |
Display a calendar icon to |
addonAttributes |
A |
language |
Language to use, can be one of
|
tz |
The timezone. |
inline |
If |
readonly |
If |
onkeydown |
Attribute passed to the input field. |
width |
The width of the input, e.g. |
dateTimeSeparator |
Separator between date and time, default to |
timeFormat |
Desirable time format. You can use:
|
minHours |
Minimal hours value, must be between 0 and 23. You will not be able to choose value lower than this. |
maxHours |
Maximum hours value, must be between 0 and 23. You will not be able to choose value higher than this. |
minMinutes |
Minimal minutes value, must be between 0 and 59. You will not be able to choose value lower than this. |
maxMinutes |
Maximum minutes value, must be between 0 and 59. You will not be able to choose value higher than this. |
hoursStep |
Hours step in slider. |
minutesStep |
Minutes step in slider. |
... |
Arguments passed to |
a Date
object or a POSIXct
in UTC timezone.
Since shinyWidgets 0.5.2 there's no more conflicts with shiny::dateInput()
.
demoAirDatepicker()
for demo apps
updateAirDateInput()
for updating from server
if (interactive()) {
# examples of different options to select dates:
demoAirDatepicker("datepicker")
# select month(s)
demoAirDatepicker("months")
# select year(s)
demoAirDatepicker("years")
# select date and time
demoAirDatepicker("timepicker")
# You can select multiple dates :
library(shiny)
library(shinyWidgets)
ui <- fluidPage(
airDatepickerInput(
inputId = "multiple",
label = "Select multiple dates:",
placeholder = "You can pick 5 dates",
multiple = 5, clearButton = TRUE
),
verbatimTextOutput("res")
)
server <- function(input, output, session) {
output$res <- renderPrint(input$multiple)
}
shinyApp(ui, server)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.