The new HTML5 input types are great. Opera's new built-in date picker is a breeze, and Chrome has at least supported the new input type with a spin-wheel implementation.
But is there any way to set the default value of the date field to today's date? With Opera, I can choose 'Today' from the date picker, and as soon as I click on either of the step buttons in Chrome, it increments/decrements from today's date.
I'm not shy to code a solution to this minor problem, but it seems silly to me that both of the browsers are fully aware of the current date but won't automatically just pop it in (at least as a placeholder).
Here is an easy way to do this with javascript.
You could fill the default value through javascript as seen here: http://jsfiddle.net/7LXPq/
I would probably put a bit of extra time to see if the month and date are single digits and prefix them with the extra zero...but this should give you an idea.
EDIT: Added check for the extra zero
The following code works well:
Note that this relies on PHP.
Very Simple, Just use server side languages like PHP,ASP,JAVA or even you can use javascript.
Here is the solution
Follow the standard Y-m-d format, if you are using PHP
The JavaScript Date object provides enough built-in support for the required format to avoid doing it manually:
Add this for correct timezone support:
jQuery:
Pure JS: