dateRangeMonthsInput: Funtion to create month level date range input

Description Usage Arguments Value Examples

View source: R/utility_functions.R

Description

Shiny doesn't have a way to restrict selection at month level. This function tries to overcome this shortfall by adding an extra more argument minviewmode.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
dateRangeMonthsInput(
  inputId,
  label,
  start = NULL,
  end = NULL,
  min = NULL,
  max = NULL,
  format = "yyyy-mm-dd",
  startview = "month",
  minviewmode = "months",
  weekstart = 0,
  language = "en",
  separator = " to ",
  width = NULL
)

Arguments

inputId

The input slot that will be used to access the value.

label

Display label for the control, or NULL for no label.

start

The initial start date. Either a Date object, or a string in yyyy-mm-dd format. If NULL (the default), will use the current date in the client's time zone.

end

The initial end date. Either a Date object, or a string in yyyy-mm-dd format. If NULL (the default), will use the current date in the client's time zone.

min

The minimum allowed date. Either a Date object, or a string in yyyy-mm-dd format.

max

The maximum allowed date. Either a Date object, or a string in yyyy-mm-dd format.

format

The format of the date to display in the browser. Defaults to "yyyy-mm-dd".

startview

The date range shown when the input object is first clicked. Can be "month" (the default), "year", or "decade".

minviewmode

The selection level to stop the date hierarchy, "months" by default.

weekstart

Which day is the start of the week. Should be an integer from 0 (Sunday) to 6 (Saturday).

language

The language used for month and day names. Default is "en". Other valid values include "ar", "az", "bg", "bs", "ca", "cs", "cy", "da", "de", "el", "en-AU", "en-GB", "eo", "es", "et", "eu", "fa", "fi", "fo", "fr-CH", "fr", "gl", "he", "hr", "hu", "hy", "id", "is", "it-CH", "it", "ja", "ka", "kh", "kk", "ko", "kr", "lt", "lv", "me", "mk", "mn", "ms", "nb", "nl-BE", "nl", "no", "pl", "pt-BR", "pt", "ro", "rs-latin", "rs", "ru", "sk", "sl", "sq", "sr-latin", "sr", "sv", "sw", "th", "tr", "uk", "vi", "zh-CN", and "zh-TW".

separator

String to display between the start and end input boxes.

width

The width of the input, e.g. '400px', or '100%'; see validateCssUnit().

Value

A date range input for shiny.

Examples

1
2
3
4
5
6
7
if (interactive()) {
ui <- shiny::fluidPage(
dateRangeMonthsInput("daterange1", "Date range:", start = "2001-01-01"
, end = "2010-12-31", minviewmode = "months")
)
shiny::shinyApp(ui, server = function(input, output) { })
}

deepjyot1991/zimplify documentation built on Dec. 19, 2021, 10:09 p.m.