trafficonese / daterangepicker

Shiny Input for Date Ranges
https://trafficonese.github.io/daterangepicker/
Other
15 stars 2 forks source link

How to set time zones? #9

Open BradtheOldGit opened 1 year ago

BradtheOldGit commented 1 year ago

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"))))

trafficonese commented 1 year ago

Hey, Yes, apparently it only works for UTC times. There have been several attempts to include the timezone argument, but apparently this just resulted in more errors. See this comment: https://github.com/dangrossman/daterangepicker/pull/1620