evansmwendwa / ng2-daterangepicker

Usage Demos update in this url >>>
https://codesandbox.io/s/6yr1zm18w3
MIT License
132 stars 89 forks source link

There is not reset options to reset date or clear date #95

Closed pramodrwt closed 6 years ago

evansmwendwa commented 6 years ago

I believe you can implement that in your app

pramodrwt commented 6 years ago

With help of @ViewChild, I have done this

mikecabana commented 6 years ago

How may I ask you did this out of curiosity. Looking quickly would just set startDate and endDate to ''.

mherried commented 6 years ago

Example @ViewChildren(DaterangePickerComponent) singledates: QueryList; ngAfterViewInit() { this.singledates.forEach((datepickerinstance) => datepickerinstance.datePicker.element.val('')); }

pramodrwt commented 6 years ago

import { DaterangePickerComponent } from 'ng2-daterangepicker';

@ViewChild(DaterangePickerComponent) private picker: DaterangePickerComponent;

//reset start date and end date this.picker.datePicker.setStartDate(new Date()); this.picker.datePicker.setEndDate(new Date());