Skip to content

Add select and input[type='number'] as choices for time inputs#7

Open
strux wants to merge 4 commits into
mspanc:masterfrom
strux:new-time-inputs
Open

Add select and input[type='number'] as choices for time inputs#7
strux wants to merge 4 commits into
mspanc:masterfrom
strux:new-time-inputs

Conversation

@strux

@strux strux commented Apr 9, 2013

Copy link
Copy Markdown

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

@mspanc

mspanc commented Apr 10, 2013

Copy link
Copy Markdown
Owner

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.

@strux

strux commented Apr 10, 2013

Copy link
Copy Markdown
Author

Hi saepia,

I went ahead and made those changes as they were both good points. Feel free to use or not...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants