Setting Default Date / Time
Setting the default is simple - you can simply set the input element - however, this is risky, as it must be in the exact same format that datebox will output. Better is to use the option “defaultValue”. Please refer to the API docs on “defaultValue”, as there are quite a few options for the format of the default.
Additionally, when setting a default, you may also want to take advantage of “showInitialValue”.
If for some reason you need to translate based off of the default value - perhaps your default is a flight departure date, and you wish to guess that the user will return a week after that, you can use:
- “startOffsetYears” : Offset defaultValue by # years
- “startOffsetMonths” : Offset defaultValue by # months
- “startOffsetDays” : Offset defaultValue by # days
Note these will be applied to “today” if the input element is empty as well. (for instance, if you want the control to start one year from today, just set ‘startOffsetYears’ to 1)