Changing the date from outside the datepicker
See original GitHub issueI’m using the flatpickr with the weekSelect plugin. I have 3 buttons outside the datepicker to quickly switch from weeks or to go to today. If I switch weeks outside the datepicker and open the datepicker the previous date is still highlighted like you can see on the image below.
I tried to change the date in the datepicker with:
flatpickr.config.defaultDate = newDate;
But this doesn’t change the highlighted date inside the datepicker.
At the moment I create a new instance of the flatpickr with the correct date when you switch weeks from outside the datepicker. It works but it is not a clean solution.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
datetimepicker sets date to todays date on when clicking outside
If you don't do this, the current date will replace your original date when you just want to close the datetimepicker. $('input.datetime').
Read more >Change how a date or time is displayed in a date picker, text ...
In the Display the date like this list in the Date and Time Format dialog box, click the display style that you want....
Read more ><input type="date"> - HTML: HyperText Markup Language
In this example, we create 2 sets of UI elements for choosing dates: a native <input type="date"> picker and a set of 3...
Read more >Date Range Picker — JavaScript Date & Time Picker Library
If you provide a string, it must match the date format string set in your ... How to prevent date picker popover /...
Read more >Datepicker - Angular Material
The (dateInput) event will fire whenever the value changes due to the user typing or selecting a date from the calendar. The (dateChange)...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks @joshualouisjenson and @chmln
There is now a new problem that occurs. I’m using the flatpickr with the weekSelect plugin. When I call the
flatpickr.setDate(new Date('2017/12/04'))
it doesn’t select the whole week but only that specific date.I also tried
flatpickr.setDate('week 50')
but this selects also only the first day of the week.See https://chmln.github.io/flatpickr/instance-methods-properties-elements/#setdate-date-triggerchange-datestrformat