Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In the 'date-picker' component. When using the date type to pass 'disabledDate', the end date cannot be selected, which is not as expected #8805

Open
Leon-Shaw opened this issue Sep 29, 2024 · 2 comments
Assignees

Comments

@Leon-Shaw
Copy link

Reproduction link

https://stackblitz.com/edit/angular-taetoz?file=src%2Fapp%2Fapp.component.ts

Steps to reproduce

import { Component } from '@angular/core';

@Component({
  selector: 'nz-demo-date-picker-format',
  template: `
    <nz-date-picker [nzFormat]="dateFormat" [nzDisabledDate]="disabledDate"></nz-date-picker>
  `,
  styles: [
    `
      nz-date-picker
    `
  ]
})
export class NzDemoDatePickerFormatComponent {
  dateFormat = 'yyyy/MM/dd';
  disabledDate = (time: Date): boolean => {
    return new Date(time) < new Date("2024-09-16") || new Date(time) > new Date("2024-09-30");
  };
}

What is expected?

The deadline of September 30th can be selected

What is actually happening?

The component did not respond after clicking on the deadline of September 30th

Environment Info
ng-zorro-antd 18.1.1
Browser Google Chrome Version 129.0.6668.71 (Official Build) (64-bit)
@Leon-Shaw
Copy link
Author

I can only use it this way now, but it's not beautiful enough

  disabledDate = (time: Date): boolean => {
    const endTimeDateOnly = new Date(this.endTime);
    endTimeDateOnly.setHours(0, 0, 0, 0); 
    const endTimeEndOfDay = new Date(endTimeDateOnly.getTime() + 24 * 60 * 60 * 1000 - 1);
    return new Date(time) < new Date(this.startTime) || new Date(time) > endTimeEndOfDay;
  };

@kira-ru
Copy link

kira-ru commented Oct 7, 2024

same problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants