React Reactstrap 18 岁或以上日期
我正在开发一个有表单的项目。我正在使用 Reacttsrap。其中一个字段是用户的日期。我需要使用一种允许 18 岁或以上用户使用的逻辑。另外,禁用未来日期。 Reactstrap 文档中对此没有太多解释。另外,我在网上看到了很多例子,但我还没有看到一个满足这些要求并使其工作的例子。 目前,我有以下形式的代码:
<FormGroup>
<Input
id='user-age'
name='date'
type='date'
aria-label='Date of birth'
value={this.state.date}
// onChange={(event) => this.handleInputChange(event)}
/>
<Label for='user-age'>*Date of birth (DD/MM/YY)</Label>
</FormGroup>
注释的代码只是一个使其工作的处理程序的想法。任何帮助将不胜感激。
I am working on a project that has a form. I am using Reacttsrap for it. One of the fields is a date for the user. I need to use a logic that will allow users with age 18 or older. Also, disable future dates. There isn't much explanation about it in the reactstrap documentation. Also, I have seen many examples online, but I haven't seen one with these requirements and make it work.
Currently, I have this code of the form:
<FormGroup>
<Input
id='user-age'
name='date'
type='date'
aria-label='Date of birth'
value={this.state.date}
// onChange={(event) => this.handleInputChange(event)}
/>
<Label for='user-age'>*Date of birth (DD/MM/YY)</Label>
</FormGroup>
The commented code is just an idea of a handler to make it work. Any help would be much appreciated it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我刚刚从这里找到了一个答案,它帮助我解决了问题。
I just found an answer from here that it helped me solve the issue.