trafficonese / daterangepicker Goto Github PK
View Code? Open in Web Editor NEWShiny Input for Date Ranges
Home Page: https://trafficonese.github.io/daterangepicker/
License: Other
Shiny Input for Date Ranges
Home Page: https://trafficonese.github.io/daterangepicker/
License: Other
Is there an easy way to mimic shiny::dateRangeInput
's UI? I'd like to make daterangepicker
look like this (with the entire container being a single button).
It looks like there's a way to make the original daterangepicker
appear as a button (here http://www.daterangepicker.com/#ex4), but I'm having trouble getting it to work. Any help or pointers would be greatly appreciated!
R names (such as the keys of a named list) must be in native encoding. Under windows, this prevents names from containing unicode characters (e.g. emoji or non-ascii characters that don't fit in the current locale codepage)
It would be nice if there was a way to set the range labels in daterangepicker without using R names.
You could add a separate optional character argument rangeNames = names(ranges)
, or allow ranges
to have a different schema, such as
ranges = list(
list(
label = "๐",
value = c("2023-01-01", "2023-12-31")
),
list(
label = "Another label",
value = c("2022-01-01", "2022-12-31")
)
)
Hello,
Could you consider implementing Day / Week / Month / Quarter / Year calendar modes as https://sensortower.github.io/daterangepicker/? I think it would be a very useful feature.
Thank you in advance.
I'm not sure if this is a mistake or if I missed something in the documentation. If the latter, what should I look out for?
The time selected in the picker differs from the internal value by one hour.
library(shiny)
library(daterangepicker)
## UI ##########################
ui <- fluidPage(
verbatimTextOutput("print"),
daterangepicker(
inputId = "daterange",
label = "Pick a Date",
start = Sys.Date() - 30, end = Sys.Date(),
style = "width:100%; border-radius:4px",
options = list(
showDropdowns = TRUE,
timePicker = TRUE,
timePicker24Hour = TRUE,
autoApply = TRUE
)
),
)
## SERVER ##########################
server <- function(input, output, session) {
output$print <- renderPrint({
req(input$daterange)
input$daterange
})
}
shinyApp(ui, server)
Thanks in advance!
In my current application I use perioddaterangepicker
to choose from quarters. It would be nice to have the possibility to provide a custom format in which the chosen range is displayed.
Example (using German locale):
2022Q3 โ 2023Q2
instead of
01.07.2022 โ 30.06.2023
Prepare for release:
urlchecker::url_check()
devtools::check(remote = TRUE, manual = TRUE)
devtools::check_win_devel()
rhub::check_for_cran()
revdepcheck::revdep_check(num_workers = 4)
cran-comments.md
Submit to CRAN:
usethis::use_version('minor')
devtools::submit_cran()
Wait for CRAN...
usethis::use_github_release()
usethis::use_dev_version()
Prepare for release:
git pull
urlchecker::url_check()
devtools::check(remote = TRUE, manual = TRUE)
devtools::check_win_devel()
rhub::check_for_cran()
revdepcheck::revdep_check(num_workers = 4)
cran-comments.md
git push
Submit to CRAN:
usethis::use_version('minor')
devtools::submit_cran()
Wait for CRAN...
git push
usethis::use_github_release()
usethis::use_dev_version()
git push
Hello,
I have created a daterangepicker using the below code.
daterangepicker(
inputId = "datepicker",
label = NULL,
start = as.Date(Sys.time() + (5.5*60*60)) - 1,
end = as.Date(Sys.time() + (5.5*60*60)),
max = as.Date(Sys.time() + (5.5*60*60)),
language = "en",
ranges = list(
"Today" = as.Date(Sys.time() + (5.5*60*60)),
"Yesterday" = as.Date(Sys.time() + (5.5*60*60)) - 1,
"Last 3 days" = c(as.Date(Sys.time() + (5.5*60*60)) - 2, as.Date(Sys.time() + (5.5*60*60))),
"Last 7 days" = c(as.Date(Sys.time() + (5.5*60*60)) - 6, as.Date(Sys.time() + (5.5*60*60))),
"Last 30 days" = c(as.Date(Sys.time() + (5.5*60*60)) - 29, as.Date(Sys.time() + (5.5*60*60)))
),
icon = NULL
options = daterangepickerOptions(timePicker = TRUE, timePicker24Hour = TRUE, alwaysShowCalendars = TRUE, autoApply = FALSE)
)
observeEvent(input$datepicker, {
...
})
The datepicker works as expected for all cases other then the Custom selector part, even though autoApply is set to false, the input$datepicker is triggered as soon as the end date is selected and doesn't wait until apply button is clicked.
When we add a timepicker to the datepicker, whenever any change is made in the from time or end time, the input$datepicker is triggered immediately without having to click apply.
Is this a bug or expected behaviour ?
I've tried to use bookmarking on my shiny dashboard with daterangepicker, and what I observe is that other inputs get their values from the session (I use url backend), while daterangepicker is initialized to default values.
How to setup time zones? I want dates from the 24/October so I have to select the 23/October. Then the table is subset correctly. Guessing the calendar is running on UTC? Thanks.
```
daterangepicker(
inputId = "Dates",
label = "Date Range",
start = as_datetime(format(Sys.time(), '%Y-%m-%d'), tz = "Australia/Sydney") - hours(24),
end = as_datetime(format(Sys.time(), '%Y-%m-%d'), tz = "Australia/Sydney") + hours(24) - seconds(1),
max = as_datetime(format(Sys.time(), '%Y-%m-%d'), tz = "Australia/Sydney") + hours(24) - seconds(1),
options = daterangepickerOptions(maxSpan = list("days" = 2),
timePicker = TRUE,
timePicker24Hour = TRUE,
timePickerIncrement = 1,
cancelIsClear = TRUE,
locale = list(format = "LL",
separator = ' โโ ',
cancelLabel = 'Clear',
daysOfWeek = format(seq.Date(as.Date("2000-01-03"),
as.Date("2000-01-09"),
by = "days"), "%a"),
monthNames = format(seq.Date(as.Date("2000-01-01"),
as.Date("2000-12-31"),
by = "months"), "%b"))))
Hi @trafficonese. First of all thank you for making this package available.
I have noticed that not all arguments that one gives to daterangepicker
are also updateable with updateDaterangepicker
. Most notable the ranges
.
Would it be possible to also have these included?
eg.:
updateDaterangepicker(session, "daterange",
# ranges = list("Today" = Sys.Date()), # -> Not possible.
options = list( linkedCalendars = FALSE)
)
Other arguments like: language
, style
and class
could also maybe be included to be updated.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.