How to open calendar to todays date if there is no date present in input field using bootstrap datetime picker

痴心易碎 提交于 2020-06-29 04:08:14

问题


I am using Angular8+ and Jquery to open a calendar. I have used bootstrap datetimepicker to open the calendar. Now i have opened calendar and selected a date. And now i delete the date filled in it and open calendar, it opens the calendar with the previously selected month and year of calendar instead of opening to present date. Kindly help me to solve this.

DEMO:DEMO

TS:

ngAfterViewInit() {
    $(".effectiveDate")
      .datetimepicker({ format: "L", useCurrent: false })
      .on("dp.change", e => {
        if (e.date) {
          const date = e.date.format("L");
          this.date = date;

        } else {
          this.date = null;
        }
      });
  }

Issue is: Now i choosed 09/09/2009 and i have cleared it, when i again click on Add and click on input it shows me calendar of september 2009, instead of showing current date, month and year.

来源:https://stackoverflow.com/questions/62344663/how-to-open-calendar-to-todays-date-if-there-is-no-date-present-in-input-field-u

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!