0

I am using pickadate for date-picking. Say currently we are in April and I navigate to June or select a date in june and then clear the date. Now if i re-open the datepicker it shows june and not the current month i.e. April.

I have the datepicker initialized as

lt dpInit = $('.datepicker').pickadate(optionsObject);

I tried to do

let dp = $('.datepicker').pickadate().pickadate('picker');
dp.stop().start();
or
dp.stop();
dp.start();

This leads to datepicker being stopped but doesn't start back. I thought the dpInit and dp are two separate instances so probably it happens so and I did

lt dpInitPick = $('.datepicker').pickadate(optionsObject).pickadate('picker');
dpInitPick.stop().start();

Again same result.

I tried to do this.stop().start() inside the event in optionsObject still the same result i.e.

optionsObject = {
  onOpen: function() {
    this.stop().start(); //same result of datepicker stopping but not starting again.
  }
}

instead of onOpen I tried onRender, onClose etc too. When I say it doesn't start I mean clicking on the datepicker input element does not open the date-picker anymore.

How do I reset the datepicker to point to current date?

wallop
  • 2,510
  • 1
  • 22
  • 39

1 Answers1

0

Ah figured a solution, I ended up using

this.set('select', new Date());
this.clear();

in order to make datepicker point to current date

wallop
  • 2,510
  • 1
  • 22
  • 39