Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

startDate with "dd/mm/yyy hh:ii" format cause unselectable date #17

Open
InternalServerError opened this issue May 20, 2015 · 1 comment

Comments

@InternalServerError
Copy link

Hi,

I've a trouble :
I'm trying to set up the bundle but I can't set the desired startDate or format.
Here my formType :
$builder
->add('dateBegin'
, 'collot_datetime'
, array(
'pickerOptions' =>
array('format' => 'dd/mm/yyyy hh:ii'
, 'weekStart' => 1
, 'startDate' => date('d/m/Y H:i')
, 'endDate' => '01/01/3000'
, 'daysOfWeekDisabled' => '0,6'
, 'autoclose' => true
, 'startView' => 'month'
, 'minView' => 'day'
, 'maxView' => 'decade'
, 'todayBtn' => true
, 'todayHighlight' => true
, 'keyboardNavigation' => true
, 'language' => 'fr'
, 'forceParse' => true
, 'minuteStep' => 30
, 'pickerReferer ' => 'default' //deprecated
, 'pickerPosition' => 'bottom-right'
, 'viewSelect' => 'day'
, 'showMeridian' => false
, 'initialDate' => date('d/m/y', time()), //example
)
)

But when I click on my input I cannot select any date whereas I set format to "dd/mm/yyy" and startDate to "date('d/m/Y')" everything works fine but I lose the datetime format for an only date one.

Where might be my mistakes ?

Thanks.

@benoliver999
Copy link

benoliver999 commented Jul 25, 2017

I have a similar issue.

$date = new \DateTime();

->add('date', DatetimeType::class, array(
    'pickerOptions' => array(
        'format' => 'dd/mm/yyyy hh:ii',
        'startDate' => $date,
    )
)

This makes the date picker not show up.

Firefox's console error says: TypeError: this.startDate.getUTCFullYear is not a function

The following fixes it:

->add('date', DatetimeType::class, array(
    'pickerOptions' => array(
        'format' => 'dd/mm/yyyy hh:ii',
        'startDate' => date('Y-m-d'),
    )
)

but I think I did see in the docs that it should be able to take a date object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants