Add select and input[type='number'] as choices for time inputs
I added some new inputs/features for a project I'm working on and thought you may be interested in merging them.
This branch adds several new options to the input:
:time_input => :text (default), :select or :number
The following apply to input types: :select and :number
:minute_step => integer
:hours_24 => true or false (default)
Examples:
m.input :born_at,
as: :just_datetime_picker, time_input: :select, minute_step: 15
# Would render minute as select with four options: 00, 15, 30, 45
m.input :born_at,
as: :just_datetime_picker, time_input: :number, hours_24: true
# Would render hour as <input type='number'... with 24 options: 00..23
Hi Ben, thank you for your contribution.
I will definitely merge such functionality into this gem, but with some modifications:
- 24h mode has to be default as otherwise it will break default behavior of current and past versions,
- AM/PM indicator should be taken from locales (e.g. Greeks use π.µ. and µ.µ., respectively).
So if you plan to rely on this gem in your project when I will release merged version, please take this into account.
Hi saepia,
I went ahead and made those changes as they were both good points. Feel free to use or not...