Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Form] Birthday input does not show all dates #5554

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

Closed
cjwprostar opened this issue Sep 19, 2012 · 2 comments
Closed

[Form] Birthday input does not show all dates #5554

cjwprostar opened this issue Sep 19, 2012 · 2 comments

Comments

@cjwprostar
Copy link

Symfony Standard Edition v2.1.2

While looking at some of the form input options, I found an odd problem. When creating a birthday input using a range above 110 (such as the default of 120), any choices above (date('Y') - 110) aren't being displayed even though an option element is being created. Is anyone else having this problem?

public function indexAction() {
    $form = $this->createFormBuilder()
        ->add('birthday', 'birthday')
        ->add('birthday_working', 'birthday', array(
            'years' => range(date('Y') - 110, date('Y')),
        ))
        ->getForm();

    // Template is the basic form template from the book
    return $this->render('ABCDefaultBundle:Default:default.html.twig', array(
        'form' => $form->createView(),
    ));
}
<div id="form_birthday">
    <select id="form_birthday_year" name="form[birthday][year]" required="required">
        <option value="1892"></option>
        <option value="1893"></option>
        <option value="1894"></option>
        <option value="1895"></option>
        <option value="1896"></option>
        <option value="1897"></option>
        <option value="1898"></option>
        <option value="1899"></option>
        <option value="1900"></option>
        <option value="1901"></option>
        <option value="1902">1902</option>
        <option value="1903">1903</option>
        <option value="1904">1904</option>

... and so on.

@pborreli
Copy link
Contributor

probably related to pre-epoc on 32 bit system http://stackoverflow.com/questions/5623647/php-32bit-date-parsing-for-dates-before-13dec-1901

@pborreli
Copy link
Contributor

Duplicate of #5227 ?

@stof stof closed this as completed Oct 22, 2012
fabpot added a commit that referenced this issue Nov 28, 2013
This PR was squashed before being merged into the 2.2 branch (closes #9314).

Discussion
----------

[Form] Fix DateType for 32bits computers.

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #5227,#5554
| License       | MIT
| Doc PR        | -

Fix an issue due to 32bits machines, date can be only between 1902-2037.
Simply not add date if false. Can be good to add this to 2.3 and master too.

Commits
-------

b80fb43 [Form] Fix DateType for 32bits computers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants