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

RangePicker's presetted ranges won't generate new value for new click. #8281

Closed
Hsia1993 opened this Issue Nov 22, 2017 · 4 comments

Comments

Projects
None yet
6 participants
@Hsia1993

Hsia1993 commented Nov 22, 2017

Version

2.13.10

Environment

Google Chrome 62.0.3202.94

Reproduction link

https://codepen.io/anon/pen/GOxzvM?editors=0010

Steps to reproduce

please open the codepen link first then:

  1. Open rangepicker then click recent two days , say you get a range [2017-11-20 15:01:28,2017-11-22 15:01:28], that's awesome.
  2. Wait for 5 sec or 1 hour then click again, you still get a range [2017-11-20 15:01:28,2017-11-22 15:01:28], definitely wrong.

What is expected?

Range value should be [2017-11-20 15:01:33,2017-11-22 15:01:33].

What is actually happening?

Range value still be the same with the old value


By definition, the type of DatePickers ranges attribute is { range: string: moment[] }, this is wrong cause current time is not a constant, it should be { range: string: () => moment []}, then for every trigger you will always get the current time

@Hsia1993 Hsia1993 changed the title from [BUG]RangePicker's presetted ranges won't generate new value for new click. to RangePicker's presetted ranges won't generate new value for new click. Nov 22, 2017

@ddcat1115 ddcat1115 added the Bug🐛 label Nov 22, 2017

@yesmeck yesmeck assigned yesmeck and unassigned benjycui Jan 24, 2018

yesmeck added a commit that referenced this issue Jan 31, 2018

yesmeck added a commit that referenced this issue Jan 31, 2018

yesmeck added a commit that referenced this issue Jan 31, 2018

yesmeck added a commit that referenced this issue Jan 31, 2018

yesmeck added a commit that referenced this issue Feb 1, 2018

Allow function for preset range (#9195)
* Allow function for preset range

Close #8281

* Rename RangePickerRange to RangePickerPresetRange

@yesmeck yesmeck closed this Feb 2, 2018

@yesmeck

This comment has been minimized.

Member

yesmeck commented Feb 2, 2018

Will release this weekend.

@topwood

This comment has been minimized.

topwood commented Feb 9, 2018

example on https://ant.design/components/date-picker-cn/ still has the problem, please update the example and show how to use the function

@yesmeck

This comment has been minimized.

Member

yesmeck commented Feb 9, 2018

@topwood Could you send a PR?

@topwood

This comment has been minimized.

topwood commented Feb 9, 2018

@yesmeck sorry, a say this because i do not know how to use it.

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