datepicker

Set default value for datepicker using jQuery in Drupal

Datepicker in drupal is rendered as separate select elements for day, month and year by default which makes it difficult to set a default value if we want to set it to some string value, eg. today, +2 months, etc. This page is to check how we can set default value for datepicker using a simple jQuery.

Get string from PHP

Consider you have the above string value. If you are sending this value from a php code, convert it to a date format using strtotime().