nfq-eta / time-duration-type
Form type for durations
Installs: 4 179
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 5
Forks: 0
Open Issues: 0
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-10-15 04:08:30 UTC
README
Allows to input durations in format hh:mm
or hh:mm:ss
Options
store_as
Model data format
Valid values are
seconds
(Nfq\Bundle\TimeBundle\Form\Type\TimeDurationType::STORE_SECONDS)minutes
(Nfq\Bundle\TimeBundle\Form\Type\TimeDurationType::STORE_MINUTES)(default)
display_seconds
boolean for displaying seconds parts. Must be true for when storing as seconds.
Defaults to false
Minutes stored as seconds example
/** * {@inheritdoc} */ public function buildForm(FormBuilderInterface $builder, array $options): void { $builder ->add( 'time', TimeDurationType::class, [ 'store_as' => TimeDurationType::STORE_SECONDS, 'display_seconds' => false, 'required' => false, ] ); }