-
Reproduction: https://gist.github.com/zshall/ab9af546cbc2ef57574213197f7d928c I'm running into a bug with the latest version of DateRangePicker in which using a pre-defined date / time range results in the correct date range getting selected but the $('#picker').daterangepicker({
timePicker: true,
alwaysShowCalendars: true,
ranges: {
'Predefined Times': [
moment("6:00 pm", "hh:mm a"),
moment("2:00 am", "hh:mm a").add(1, "days") // displays as 2:00 PM in the DateRangePicker dialog
]
}
} This problem doesn't only occur with date ranges that go into the next day. If I have a date range such as "today at 4 AM to 7 AM" it also displays as 4 AM to 7 PM in the picker's display. Correct behavior is observed if the ending time is Anyone else had this problem or know of a fix? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
After some investigating, I've determined one potential cause. In the So it seems that when you click a pre-defined range, it doesn't change the AM/PM selector from whatever it's set to already. If the default values on the page are 12 AM - 12 PM and the new range is 3 - 7 AM, that range will be set but the selector will still be PM for the end date (and still AM for the start date for that matter). When we load the selector again it's still set and this code fires, shifting the dates around and adding 12 hours since it was never set when we closed the form. Looking at what I can do to propose a fix. |
Beta Was this translation helpful? Give feedback.
-
#2320 I've implemented and tested a fix for this issue. When selecting a pre-defined date range, if using the |
Beta Was this translation helpful? Give feedback.
#2320 I've implemented and tested a fix for this issue. When selecting a pre-defined date range, if using the
timePicker
we now set the AM/PM selector to the value from the pre-defined dates.