-
Notifications
You must be signed in to change notification settings - Fork 123
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
时间日期相关组件接口问题 #814
Comments
TimePicker 遇到过显示 from参数的options选项,也建议支持。 |
这个现在已经支持了,有
我看了下 |
需要讨论的
|
保持结构统一,更倾向于使用DatePickerDayValue这样的格式,既{ year: number } and { hour: number }。 |
又看了一下
|
ISO 8601 对应的日期格式
星期有其特殊性,比如
|
目前
DatePicker
的value
类型为Date
,TimePicker
的value
类型为string
(例如'10:08'
),后续可能还会支持DateTimePicker
,value
类型应该会是Date
。这样感觉其实有点奇怪。由于后续 JavaScript 应该会原生支持 Temporal,可以考虑将三者的接口分别对应到Temporal.PlainDate
/Temporal.PlainTime
/Temporal.PlainDateTime
的from
方法参数上面(也需要考虑DatePicker[type="year"]
和DatePicker[type="month"]
),已保证未来可以方便地构造Temporal
对象。Ps. 发现
TimePicker
用的mode
,DatePicker
用的type
,也需要统一一下。type
value
类型DatePicker
day
DatePickerDayValue
DatePicker
month
DatePickerMonthValue
DatePicker
year
number
TimePicker
TimePickerValue
DateTimePicker
DateTimePickerValue
兼容性和迁移
可以考虑添加一个
temporal
prop,来开启新的接口,未来 major 版本升级的时候切换到新的逻辑上,把当前的兼容处理去除。未开启的情况下,可以考虑 warning 提示升级。另外,
Temporal
接口的month
不是从0
开始的,而是更符合直觉的1
–12
。The text was updated successfully, but these errors were encountered: