加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – sonata_type_datetime_picker初始日期

发布时间:2020-12-13 21:52:57 所属栏目:PHP教程 来源:网络整理
导读:现在,当日期输入为空并且我将触发datepicker时,它将给我当前的日期时间.我想更改此配置以获取当前日期,但时间为00:00:00.我不知道怎么弄这个.有任何想法吗? 我知道我在创建datepicker时有这个选项: "action","attr","auto_initialize","block_name","by_re
现在,当日期输入为空并且我将触发datepicker时,它将给我当前的日期时间.我想更改此配置以获取当前日期,但时间为00:00:00.我不知道怎么弄这个.有任何想法吗?

我知道我在创建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"

我尝试使用“dp_default_date”,但它在页面刷新时填充空输入. “小时”和“分钟”不起作用.

解决方法

我通过这种方式修复了初始日期

->add('dateOfBirth','sonata_type_date_picker',array(
                'label' => 'Birthdate','dp_default_date' => '01-1975','datepicker_use_button' => false,))

这里提供的选项列表

sonata-project/core-bundle/Form/Type/DateTimePickerType.php

sonata-project/core-bundle/Form/Type/BasePickerType.php

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读