Issues with date_select


I have an application where in I ask for DOB(date of birth) from users
and i am using date_select (discarding hour):

  1. If someone doesn’t enter day and month but enters YEAR(say 1980) in
    DOB - Its gets stored as 1st of Jan of that year (DOB will be 1-1-1980)

  2. More funny - if some one doesn’t enter YEAR but enters day and month
    (say 10 of March) - It takes 2001 as default year. so DOB will be

Can we not enter only value of year (1980 only) or only month and year
into datetime field? Is the only solution is to have separate field for

Also, I have questions like, when did you join this school: Again i used
date_select(discarding days): Everything alright as long as user enters
both month and year. But if somone only wishes to enter year (valid use
case), it takes Jan as default month. How do i avoid such cases?

Any thoughts?

Sandeep G

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs