bigfork/silverstripe-simpledatefield
最新稳定版本:2.0.0
Composer 安装命令:
composer require bigfork/silverstripe-simpledatefield
包简介
A SilverStripe form field for entering dates based on the UK Government’s date input pattern
README 文档
README
A form field for entering dates based on the GOV.UK Design System’s date input pattern, which uses three separate inputs for day, month, and year.
Usage
SimpleDateField::create('DateOfBirth', 'Date of birth'); // Or to offer the inputs in a different order SimpleDateField::create('DateOfBirth', 'Date of birth', null, SimpleDateField::YMD); SimpleDateField::create('DateOfBirth', 'Date of birth', null, SimpleDateField::MDY);
If you choose to manually pass a date to the $value argument, it must be in the ISO 6801 date format (YYYY-MM-DD).
Date of birth
If using this field to allow users to enter their date of birth, it’s recommended to add relevant autocomplete attributes to assist this.
$field = SimpleDateField::create('DateOfBirth', 'Date of birth'); $field->getDayField()->setAttribute('autocomplete', 'bday-day'); $field->getMonthField()->setAttribute('autocomplete', 'bday-month'); $field->getYearField()->setAttribute('autocomplete', 'bday-year');
Styling
No front-end styling is provided to display the fields “inline”. You could use the CMS styling for inspiration: check out client/src/bundles/cms.scss.
Todo
- Add translation entities for labels/error messages
- Min/max date options
- Unit tests
统计信息
- 总下载量: 6.67k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2019-08-15