Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Closed
cjwprostar opened this Issue · 2 comments

3 participants

@cjwprostar

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

Duplicate of #5227 ?

@stof stof closed this
@WedgeSama WedgeSama referenced this issue from a commit
@WedgeSama WedgeSama Fix DateType for 32bits computers.
Fix an issue due to 32bits machines, date can be only between 1902-2037.
Simply not add date if false.
Issues: #5227 #5554
48a6d96
@WedgeSama WedgeSama referenced this issue from a commit
@WedgeSama WedgeSama Fix DateType for 32bits computers.
Fix an issue due to 32bits machines, date can be only between 1902-2037.
Simply not add date if false.
Issues: #5227 #5554
11b04af
@fabpot fabpot referenced this issue from a commit
@fabpot fabpot bug #9314 [Form] Fix DateType for 32bits computers. (WedgeSama)
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.
9b99f09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.