How can i make my javascript hide past months and days if it is current year?

Go To StackoverFlow.com

0

I need to hide the previous dates and months in my drop down if it is the current year. So the date should not be settable to a date before today's date, obviously. So if 2012 is selected, the months of January, February, and March won't exist in the picker, nor will April 1st (it being passed). Setting to 2013 will have all months/days available.

2012-04-04 04:50
by Nidhin Bose J.
Post your html please - mrtsherman 2012-04-04 04:53
"Don't put them in." Can't really give a more concrete answer for a question without concrete code or problem description - deceze 2012-04-04 05:00


0

May be this kind of pseudo code may help you.

  1. Get the current date from server. Do not get it from client side as it can be easily modified.

  2. create an array with all the 12 months like Jan, Feb etc.

  3. Get the current month from the date.

  4. Now filter and fetch all the months including the current month

  5. Now display current date as the first element in the list

  6. Also, list the remaining months.

2012-04-04 05:15
by UVM
there are three dropdowns for month date and year. When the current year is selected, the date and month drop downs shouldnt show the previos days and months - Nidhin Bose J. 2012-04-04 05:47
when you select the current year, validate the this year with the server date.if it is true, extract the month and date from this.Now re-populate your date and month lists that are greater than or equal to the current date.I think you are going to do the logic in Javascript - UVM 2012-04-04 05:55
Ads