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

the date-picker component support to show Customize the initial month #2020

Closed
SubinY opened this issue Aug 21, 2018 · 1 comment · Fixed by #4843
Closed

the date-picker component support to show Customize the initial month #2020

SubinY opened this issue Aug 21, 2018 · 1 comment · Fixed by #4843
Assignees
Milestone

Comments

@SubinY
Copy link

SubinY commented Aug 21, 2018

What problem does this feature solve?

At the bussiness scene, the nz-range-picker show the double month to select by the user to search their order which is past time. But the date comp have not support to change or edit the init month

What does the proposed API look like?

In nz-range-picker comp, the left panel show the last month or last year. we can add a Input property to realize this function

####date-range-popup.component.ts (line 394)

...
  @Input() dropdownClassName: string;
  @Input() showLastMonth: Boolean;
...
  private normalizeRangeValue(value: CandyDate[]): CandyDate[] {
    const [ start, end ] = value;
    const newStart = start || this.showLastMonth ? new CandyDate().subMonths(1) : new CandyDate();
    const newEnd = end && end.isSame(newStart, 'month') ? end.addMonths(1) : end || newStart.addMonths(1);
    return [ newStart, newEnd ];
  }

####candy-date.ts (add the api subMonths)

  subMonths(amount: number): CandyDate {
    return new CandyDate(subMonths(this.nativeDate, amount));
  }

It prototype look like this. I try to add a property to custom the init month or year in this comp, but i found is involve many comp to add this property

@tonny008
Copy link
Contributor

tonny008 commented Sep 3, 2018

如果选这range是用于历史记录的,那这个还是很需要的。
如默认range当天,但是日历出现的是当月和下月,但是就使用场景应该是上月和当月比较合理

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

Successfully merging a pull request may close this issue.

5 participants