| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/input-daterange.R |
| 3 |
\name{dateRangeInput} |
| 4 |
\alias{dateRangeInput} |
| 5 |
\title{Create date range input} |
| 6 |
\usage{ |
| 7 |
dateRangeInput( |
| 8 |
inputId, |
| 9 |
label, |
| 10 |
start = NULL, |
| 11 |
end = NULL, |
| 12 |
min = NULL, |
| 13 |
max = NULL, |
| 14 |
format = "yyyy-mm-dd", |
| 15 |
startview = "month", |
| 16 |
weekstart = 0, |
| 17 |
language = "en", |
| 18 |
separator = " to ", |
| 19 |
width = NULL, |
| 20 |
autoclose = TRUE |
| 21 |
) |
| 22 |
} |
| 23 |
\arguments{ |
| 24 |
\item{inputId}{The \code{input} slot that will be used to access the value.} |
| 25 |
|
| 26 |
\item{label}{Display label for the control, or \code{NULL} for no label.} |
| 27 |
|
| 28 |
\item{start}{The initial start date. Either a Date object, or a string in |
| 29 |
\code{yyyy-mm-dd} format. If NULL (the default), will use the current |
| 30 |
date in the client's time zone.} |
| 31 |
|
| 32 |
\item{end}{The initial end date. Either a Date object, or a string in |
| 33 |
\code{yyyy-mm-dd} format. If NULL (the default), will use the current |
| 34 |
date in the client's time zone.} |
| 35 |
|
| 36 |
\item{min}{The minimum allowed date. Either a Date object, or a string in |
| 37 |
\code{yyyy-mm-dd} format.} |
| 38 |
|
| 39 |
\item{max}{The maximum allowed date. Either a Date object, or a string in |
| 40 |
\code{yyyy-mm-dd} format.} |
| 41 |
|
| 42 |
\item{format}{The format of the date to display in the browser. Defaults to |
| 43 |
\code{"yyyy-mm-dd"}.} |
| 44 |
|
| 45 |
\item{startview}{The date range shown when the input object is first clicked. |
| 46 |
Can be "month" (the default), "year", or "decade".} |
| 47 |
|
| 48 |
\item{weekstart}{Which day is the start of the week. Should be an integer |
| 49 |
from 0 (Sunday) to 6 (Saturday).} |
| 50 |
|
| 51 |
\item{language}{The language used for month and day names. Default is "en". |
| 52 |
Other valid values include "ar", "az", "bg", "bs", "ca", "cs", "cy", "da", |
| 53 |
"de", "el", "en-AU", "en-GB", "eo", "es", "et", "eu", "fa", "fi", "fo", |
| 54 |
"fr-CH", "fr", "gl", "he", "hr", "hu", "hy", "id", "is", "it-CH", "it", |
| 55 |
"ja", "ka", "kh", "kk", "ko", "kr", "lt", "lv", "me", "mk", "mn", "ms", |
| 56 |
"nb", "nl-BE", "nl", "no", "pl", "pt-BR", "pt", "ro", "rs-latin", "rs", |
| 57 |
"ru", "sk", "sl", "sq", "sr-latin", "sr", "sv", "sw", "th", "tr", "uk", |
| 58 |
"vi", "zh-CN", and "zh-TW".} |
| 59 |
|
| 60 |
\item{separator}{String to display between the start and end input boxes.} |
| 61 |
|
| 62 |
\item{width}{The width of the input, e.g. \code{'400px'}, or \code{'100\%'}; |
| 63 |
see \code{\link[=validateCssUnit]{validateCssUnit()}}.} |
| 64 |
|
| 65 |
\item{autoclose}{Whether or not to close the datepicker immediately when a |
| 66 |
date is selected.} |
| 67 |
} |
| 68 |
\description{ |
| 69 |
Creates a pair of text inputs which, when clicked on, bring up calendars that |
| 70 |
the user can click on to select dates. |
| 71 |
} |
| 72 |
\details{ |
| 73 |
The date \code{format} string specifies how the date will be displayed in |
| 74 |
the browser. It allows the following values: |
| 75 |
|
| 76 |
\itemize{ |
| 77 |
\item \code{yy} Year without century (12) |
| 78 |
\item \code{yyyy} Year with century (2012) |
| 79 |
\item \code{mm} Month number, with leading zero (01-12) |
| 80 |
\item \code{m} Month number, without leading zero (1-12) |
| 81 |
\item \code{M} Abbreviated month name |
| 82 |
\item \code{MM} Full month name |
| 83 |
\item \code{dd} Day of month with leading zero |
| 84 |
\item \code{d} Day of month without leading zero |
| 85 |
\item \code{D} Abbreviated weekday name |
| 86 |
\item \code{DD} Full weekday name |
| 87 |
} |
| 88 |
} |
| 89 |
\section{Server value}{ |
| 90 |
|
| 91 |
A \link{Date} vector of length 2. |
| 92 |
} |
| 93 |
|
| 94 |
\examples{ |
| 95 |
## Only run examples in interactive R sessions |
| 96 |
if (interactive()) { |
| 97 |
|
| 98 |
ui <- fluidPage( |
| 99 |
dateRangeInput("daterange1", "Date range:", |
| 100 |
start = "2001-01-01", |
| 101 |
end = "2010-12-31"), |
| 102 |
|
| 103 |
# Default start and end is the current date in the client's time zone |
| 104 |
dateRangeInput("daterange2", "Date range:"), |
| 105 |
|
| 106 |
# start and end are always specified in yyyy-mm-dd, even if the display |
| 107 |
# format is different |
| 108 |
dateRangeInput("daterange3", "Date range:", |
| 109 |
start = "2001-01-01", |
| 110 |
end = "2010-12-31", |
| 111 |
min = "2001-01-01", |
| 112 |
max = "2012-12-21", |
| 113 |
format = "mm/dd/yy", |
| 114 |
separator = " - "), |
| 115 |
|
| 116 |
# Pass in Date objects |
| 117 |
dateRangeInput("daterange4", "Date range:", |
| 118 |
start = Sys.Date()-10, |
| 119 |
end = Sys.Date()+10), |
| 120 |
|
| 121 |
# Use different language and different first day of week |
| 122 |
dateRangeInput("daterange5", "Date range:", |
| 123 |
language = "de", |
| 124 |
weekstart = 1), |
| 125 |
|
| 126 |
# Start with decade view instead of default month view |
| 127 |
dateRangeInput("daterange6", "Date range:", |
| 128 |
startview = "decade") |
| 129 |
) |
| 130 |
|
| 131 |
shinyApp(ui, server = function(input, output) { }) |
| 132 |
} |
| 133 |
|
| 134 |
} |
| 135 |
\seealso{ |
| 136 |
\code{\link[=dateInput]{dateInput()}}, \code{\link[=updateDateRangeInput]{updateDateRangeInput()}} |
| 137 |
|
| 138 |
Other input elements: |
| 139 |
\code{\link{actionButton}()}, |
| 140 |
\code{\link{checkboxGroupInput}()}, |
| 141 |
\code{\link{checkboxInput}()}, |
| 142 |
\code{\link{dateInput}()}, |
| 143 |
\code{\link{fileInput}()}, |
| 144 |
\code{\link{numericInput}()}, |
| 145 |
\code{\link{passwordInput}()}, |
| 146 |
\code{\link{radioButtons}()}, |
| 147 |
\code{\link{selectInput}()}, |
| 148 |
\code{\link{sliderInput}()}, |
| 149 |
\code{\link{submitButton}()}, |
| 150 |
\code{\link{textAreaInput}()}, |
| 151 |
\code{\link{textInput}()}, |
| 152 |
\code{\link{varSelectInput}()} |
| 153 |
} |
| 154 |
\concept{input elements} |