日期组件怎么控制范围?

小程序 文章 2020-07-31 17:41 595 0 全屏看文

AI助手支持GPT4.0

日期组件怎么控制范围?

我用了picker组件来选取日期,当选择日期时,考虑到开始日期应小于结束日期,结束日期大于开始日期,做了控制,也实现了这个预期。

但我发现日期的显示范围没法控制,例如:我选择开始日期2020-6-35,那么结束日期应该从2020-6-35以后,才显示且用来选择,但我做不到。

我尝试做判断,但判断后的显示我不知道怎样才能正确显示??


I used the picker component to select the date. When selecting the date, considering that the start date should be less than the end date, and the end date should be greater than the start date, I made the control and realized this expectation. But I found that the display range of the date can't be controlled. For example, if I choose the start date 2020-6-35, then the end date should be displayed and used for selection after June 35, 2020, but I can't. I try to make a judgment, but I don't know how to display it correctly??

回答:

Admin²⁰²⁰:
默认的picker组件日期的显示范围没法控制,但是会禁止选择startend外的日期。也算够用了。或者用第三方日期选择组件来达到更高的需求
Distance:

不用想太多,第一个的end=第二个的start,你改了第一个的end,第二个的start也会跟着改变。

_天马行空_:

你这样,你选择的结束日期如果在开始日期之前,把你的选的结束当开始日期,结束日期重新选

🔥👦👔👖:

附上代码片段

-EOF-

AI助手支持GPT4.0