question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Changing the date from outside the datepicker

See original GitHub issue

I’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.

image

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
PieterSwittencommented, Aug 10, 2017

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found