Now, when the date input is empty and I will fire datepicker, it will give me current datetime. I want to change this configuration to get current date but with time 00:00:00. I don't know how to get this. Any ideas?
I know that I have this options in creation of datepicker:
"action", "attr", "auto_initialize", "block_name", "by_reference", "cascade_validation", "compound", "constraints", "csrf_field_name", "csrf_message", "csrf_protection", "csrf_provider", "data", "data_class", "date_format", "date_widget", "datepicker_use_button", "days", "disabled", "dp_days_of_week_disabled", "dp_default_date", "dp_disabled_dates", "dp_enabled_dates", "dp_icons", "dp_language", "dp_max_date", "dp_min_date", "dp_minute_stepping", "dp_pick_time", "dp_show_today", "dp_side_by_side", "dp_use_current", "dp_use_minutes", "dp_use_seconds", "dp_use_strict", "empty_data", "empty_value", "error_bubbling", "error_mapping", "extra_fields_message", "format", "horizontal_input_wrapper_class", "horizontal_label_class", "horizontal_label_offset_class", "hours", "inherit_data", "input", "intention", "invalid_message", "invalid_message_parameters", "label", "label_attr", "label_render", "mapped", "max_length", "method", "minutes", "model_timezone", "months", "pattern", "post_max_size_message", "property_path", "read_only", "required", "seconds", "sonata_admin", "sonata_field_description", "sonata_help", "time_widget", "translation_domain", "trim", "validation_groups", "view_timezone", "virtual", "widget", "with_minutes", "with_seconds", "years"
I tried to use "dp_default_date", but it fills empty input on page refresh. "hours" and "minutes" don't work.
I fix the initial date by this way
->add('dateOfBirth', 'sonata_type_date_picker', array(
'label' => 'Birthdate',
'dp_default_date' => '01-1975',
'datepicker_use_button' => false,
))
List of options available here
sonata-project/core-bundle/Form/Type/DateTimePickerType.php
and
sonata-project/core-bundle/Form/Type/BasePickerType.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With