nfq-eta / time-duration-type
用于表示时间长度的表单类型
v0.1.1
2018-02-09 09:48 UTC
Requires
- php: ^7.1
- symfony/form: ^2.8|^3.0|^4.0
Requires (Dev)
- phpunit/phpunit: ^7.0
This package is auto-updated.
Last update: 2024-09-15 03:55:12 UTC
README
允许以 hh:mm
或 hh:mm:ss
格式输入持续时间
选项
store_as
模型数据格式
有效值包括
seconds
(Nfq\Bundle\TimeBundle\Form\Type\TimeDurationType::STORE_SECONDS)minutes
(Nfq\Bundle\TimeBundle\Form\Type\TimeDurationType::STORE_MINUTES)(默认)
display_seconds
用于显示秒的布尔值。当以秒存储时必须为 true。默认为 false
将分钟存储为秒的示例
/** * {@inheritdoc} */ public function buildForm(FormBuilderInterface $builder, array $options): void { $builder ->add( 'time', TimeDurationType::class, [ 'store_as' => TimeDurationType::STORE_SECONDS, 'display_seconds' => false, 'required' => false, ] ); }