October: Default value for datepicker widget

Created on 1 Aug 2015  路  3Comments  路  Source: octobercms/october

When the datepicker is used with a date / datetime / timestamp column and the value has not been set yet and is therefore null, the initial date of the datepicker is displayed as the minDate.

The cause is the php conversion of a null date to "-0001-11-30". I made a hack in datepicker.php to look for that value and replace it with Carbon::create()->toDateString() which works but is probably a bad way to fix this, it would be better to catch the null value when the value is got.

Incidentally, I could not get the default setting for the datepicker type in form.yaml to work. It is not a big deal for me as long as default to today works but it may be for someone else?

Low Completed Enhancement

Most helpful comment

I would love to be able to set a default of "today" in the (blog) published field.

All 3 comments

I would love to be able to set a default of "today" in the (blog) published field.

Fixed today by #2299!

Thank you @daftspunk

Was this page helpful?
0 / 5 - 0 ratings

Related issues

d3monfiend picture d3monfiend  路  3Comments

atrauzzi picture atrauzzi  路  3Comments

mittultechnobrave picture mittultechnobrave  路  3Comments

jvanremoortere picture jvanremoortere  路  3Comments

m49n picture m49n  路  3Comments