Facebook style datepicker

Has anyone done a Facebook style datepicker with 3 dropdown boxes (month, day, and year)?

Any direction will be appreciated!

did you search in the extensions section: http://www.yiiframework.com/extensions/

Thanks for the reply. I did search the extension library but could not find any. What I’ve found are basically all JQuery based. Can you please point me to the right direction?

well, to start off I suggest you have three methods in your model class. All three rendering each drop down. You can name each drop down such as

name='User[date]' name='User[Month]' name='User[year]'

Then render the three drop downs in your create view. In your model override the beforeValidate() method and construct your final date something like:

$this->finalDate = $this->date.$this->month.$this->year;

There might be better approaches… I haven’t tested the above but if you give it a go you will iron all glitches and issues that you run into. Post any question as you go

here is an extention you have


But It displays 31 days even for February :) Check it and see


Yii Fan

Fan_Of_Yii: Thanks a lot for point me to this direction.

bettor: you are right, I should have do more search in Yii extension direction.

Happy Coding!