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

YearPicker: 关于只选择年的日期选择器属性 #4524

Closed
songdun opened this issue Jan 9, 2017 · 25 comments
Closed

YearPicker: 关于只选择年的日期选择器属性 #4524

songdun opened this issue Jan 9, 2017 · 25 comments
Labels

Comments

@songdun
Copy link

@songdun songdun commented Jan 9, 2017

日期选择器能添加一个属性让它初始化就只选择年吗?目前只有日期和月

@afc163
Copy link
Member

@afc163 afc163 commented Jan 9, 2017

单选的话,不如直接用 Select ?

@songdun
Copy link
Author

@songdun songdun commented Jan 9, 2017

产品比较事儿 要用日期选择器的样子 5555555555555555

@afc163
Copy link
Member

@afc163 afc163 commented Jan 9, 2017

单独维度的话,基于 DatePicker 改造成本较高且回报略低,用 Select 更简单和直接,我们在 https://ant.design/components/calendar/ 里也是这么做的。

你可以让你们的产品看这个回复。

@lock
Copy link

@lock lock bot commented May 2, 2018

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators May 2, 2018
@afc163 afc163 reopened this Jun 26, 2018
@afc163
Copy link
Member

@afc163 afc163 commented Jun 26, 2018

Maybe we should add a YearPicker now.

@jrschumacher
Copy link

@jrschumacher jrschumacher commented Oct 12, 2018

@afc163 I have a WIP pull request for YearPicker react-component/calendar#427

@yoyo837
Copy link
Contributor

@yoyo837 yoyo837 commented Oct 16, 2018

单纯下拉做不到 YearPicker 万年历 可选年份的需求。
Edit: 通常用在限制picker可选维度不同的地方,和DatePicker等一般是放在一起的,Picker的外观和交互更适合。

@jrschumacher Why not a picker ?

@jrschumacher
Copy link

@jrschumacher jrschumacher commented Oct 16, 2018

@yoyo837 because you get the ability to view decades similar to the other calendars. But most importantly, to me, is a consistent UX. For all date-time data gathering the user will experience a similar interface.

@aixfox
Copy link

@aixfox aixfox commented Nov 8, 2018

@afc163

Here are some reasons for YearPicker:

  1. Same styles as DatePicker.
  2. Select not exports moment instance.
  3. No disabledDate api of Select.

Hoping more consideration of year picker, thank you!

@Jetsly
Copy link

@Jetsly Jetsly commented Nov 24, 2018

话说 不支持为啥 给出这个 mode={'year'} 的选项。。。

@jrschumacher
Copy link

@jrschumacher jrschumacher commented Nov 24, 2018

@Jetsly yes they have to approve this PR first (react-component/calendar#427) then I can add the mode feature in ant-design

@lx70770
Copy link

@lx70770 lx70770 commented Dec 13, 2018

@jrschumacher 您好 请问antd大概多久可以支持 mode='year' 这个属性呢

@jrschumacher
Copy link

@jrschumacher jrschumacher commented Dec 15, 2018

@lx70770 I'm not sure Google translated that correctly. Antd/rc-calendar does not support this mode. I have not heard anything from my PR.

@lx70770
Copy link

@lx70770 lx70770 commented Dec 15, 2018

@lx70770 I'm not sure Google translated that correctly. Antd/rc-calendar does not support this mode. I have not heard anything from my PR.
That's ok , Thank you so much!

@yeluolei
Copy link

@yeluolei yeluolei commented Jan 15, 2019

+1 for this feature

@jrschumacher
Copy link

@jrschumacher jrschumacher commented Jan 15, 2019

@yeluolei will you add your reaction here: react-component/calendar#427

Sent with GitHawk

@afc163 afc163 changed the title 关于只选择年的日期选择器属性 YearPicker: 关于只选择年的日期选择器属性 Feb 27, 2019
@Fujitomy
Copy link

@Fujitomy Fujitomy commented Mar 29, 2019

{ getFieldDecorator(field)( <DatePicker placeholder={ placeholder || '请选择年份' } locale={ zhCN } // value={ this.state.time } open={ this.state.yearStartShow } mode='year' format='YYYY' // onChange={ this.handleChange } onOpenChange={ this.handleOpenChange } onPanelChange={ this.handlePanelChange } /> }

do like this ,you will fix this bug, combine use onOpenChange and onPanelChange (maybe you need onFocus onBlur)

tks, 一江西流 关于antd 日期组件只选择年份,设置mode=year无法获取value的解决办法

四个方法并用一定能完美实现你的需求,哈哈哈,官方说,你既然都单选了,为什么不用下拉框,说的好有道理,我竟无言以对
阿里产品真的考虑周全呀,>_< 但是我们产品说,我就要这样,我不管

@afc163
Copy link
Member

@afc163 afc163 commented Apr 7, 2019

The list of date-related pickers we may need:

  • YearPicker 2019
  • MonthDatePicker 05-01
  • RangePicker.YearPicker 2019 ~ 2020
  • RangePicker.MonthPicker 2019-01 ~ 2020-10
  • RangePicker.MonthDatePicker 05-01 ~ 06-08
  • RangePicker.WeekPicker 2019-23rd ~ 2019-45rd
  • TimePicker.RangePicker 11:00 ~ 18:30

@Geassu
Copy link

@Geassu Geassu commented Apr 17, 2019

we need YearPicker right now

@DongShi
Copy link

@DongShi DongShi commented Apr 28, 2019

Is the YearPicker available in the latest antd release?
How about adding a QuarterPicker?

@zhangyanling77
Copy link
Contributor

@zhangyanling77 zhangyanling77 commented May 31, 2019

{ getFieldDecorator(field)( <DatePicker placeholder={ placeholder || '请选择年份' } locale={ zhCN } // value={ this.state.time } open={ this.state.yearStartShow } mode='year' format='YYYY' // onChange={ this.handleChange } onOpenChange={ this.handleOpenChange } onPanelChange={ this.handlePanelChange } /> }

do like this ,you will fix this bug, combine use onOpenChange and onPanelChange (maybe you need onFocus onBlur)

tks, 一江西流 关于antd 日期组件只选择年份,设置mode=year无法获取value的解决办法

四个方法并用一定能完美实现你的需求,哈哈哈,官方说,你既然都单选了,为什么不用下拉框,说的好有道理,我竟无言以对
阿里产品真的考虑周全呀,>_< 但是我们产品说,我就要这样,我不管

因为UI风格要统一,哈哈哈
我就是一江西流

@afc163
Copy link
Member

@afc163 afc163 commented Jun 5, 2019

@CornerYoung
Copy link

@CornerYoung CornerYoung commented Jan 2, 2020

RangePicker组件中设置mode为mode={['month', 'month']},是想要实现月份区间的选择,这时候defaultValue会失效,请问该怎样显示默认时间?

@afc163
Copy link
Member

@afc163 afc163 commented Mar 7, 2020

We support all pickers in v4 now: https://ant.design/components/date-picker/

@afc163 afc163 closed this Mar 7, 2020
@xiaoheikejj
Copy link

@xiaoheikejj xiaoheikejj commented Dec 10, 2020

单独维度的话,基于 DatePicker 改造成本较高且回报略低,用 Select 更简单和直接,我们在 https://ant.design/components/calendar/ 里也是这么做的。

你可以让你们的产品看这个回复。

厉害厉害 牛逼

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

Successfully merging a pull request may close this issue.

None yet