Stefano
Stefano

Reputation: 23

ngx datepicker Quick select ranges not work

I would like to use the Quick select ranges option of the nxg datepicker, but not work for me. I have installed in angular with npm, i have imported the module in app.module.ts, and i have imported the css, everything works except the Quick select ranges option.

This is the code on the input tag:

<input (bsValueChange)="changeDate($event)" type="text" placeholder="Daterangepicker" class="form-control" [bsConfig]="{ ranges: ranges, containerClass: 'theme-red' }" [bsValue]="bsValue" bsDaterangepicker>

and i pass in the component the ranges value

ranges = [{
    value: [new Date(new Date().setDate(new Date().getDate() - 7)), new Date()],
    label: 'Last 7 Days'
  }, {
    value: [new Date(), new Date(new Date().setDate(new Date().getDate() + 7))],
    label: 'Next 7 Days'
  }];

what am I doing wrong?

Thank's for any help.

Upvotes: 1

Views: 982

Answers (1)

Debashree Goswami
Debashree Goswami

Reputation: 46

I had the same issue. Custom range selector is available in datepicker of ngx-bootstrap version 5.6.0 and above. Check your package.json, to verify the version of ngx you are using. I upgraded it to 5.6.0 and it started working

Upvotes: 3

Related Questions