Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9022853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:37:13+00:00 2026-06-16T05:37:13+00:00

I just recently ran into a problem, where my Symfony2 app renders form with

  • 0

I just recently ran into a problem, where my Symfony2 app renders form with invalid date choice input. Specifically, it renders the “month” select with numbers inside, instead of month names.

The definition of the form type goes like this:

$builder
        ->add('title')
        ->add('shortcut')
        ->add('description')
        ->add('category')
        ->add('release_date', 'date', array(
            'input' => 'datetime',
            'widget' => 'choice'
        ));

This definition then (by using form_widget in Twig) renders the following for month select:

<select id="nucleo_gamesbundle_gametype_release_date_month" name="nucleo_gamesbundle_gametype[release_date][month]" required="required">
  <option value="1">1326585600</option>
  <option value="2">1329264000</option>
  <option value="3">1331769600</option>
  <option value="4">1334448000</option>
  <option value="5">1337040000</option>
  <option value="6">1339718400</option>
  <option value="7">1342310400</option>
  <option value="8">1344988800</option>
  <option value="9">1347667200</option>
  <option value="10">1350259200</option>
  <option value="11">1352937600</option>
  <option value="12">1355529600</option>
</select>

Does anyone know, how to force Symfony to render option texts as month names (eg. January, February, etc.)? Thank you very much.

EDIT:
Twig template (the form part) looks like this:

<form action="{{ path('game_admin_update', {'id' : entity.id}) }}" method="post" class="form" {{ form_enctype(edit_form) }}>
  <fieldset>
    <div class="widget">
        <div class="title"><img src="{{ asset('admin/images/icons/dark/list.png') }}" alt="" class="titleIcon" /><h6>Základní informace</h6></div>
        <div class="formRow">
            {{ form_label(edit_form.title, 'form.game.title'|trans({},'admin')) }}
            <div class="formRight">{{ form_widget(edit_form.title) }}</div>
            <div class="clear"></div>
        </div>
        <div class="formRow">
            {{ form_label(edit_form.shortcut, 'form.game.shortcut'|trans({},'admin')) }}
            <div class="formRight">{{ form_widget(edit_form.shortcut) }}</div>
            <div class="clear"></div>
        </div>
        <div class="formRow">
            {{ form_label(edit_form.description, 'form.game.description'|trans({},'admin')) }}
            <div class="formRight">{{ form_widget(edit_form.description, { 'attr': {'class': 'richEditor'} }) }}</div>
            <div class="clear"></div>
        </div>
        <div class="formRow">
            {{ form_label(edit_form.release_date, 'form.game.release_date'|trans({},'admin')) }}
            <div class="formRight">{{ form_widget(edit_form.release_date) }}</div>
            <div class="clear"></div>
        </div>
        {{ form_rest(edit_form) }}
        <div class="formSubmit"><input type="submit" value="{{ 'form.game.submit.edit'|trans({},'admin') }}" class="greenB" /></div>
        <div class="clear"></div>
    </div>
</fieldset>

So nothing special there

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T05:37:15+00:00Added an answer on June 16, 2026 at 5:37 am

    Of course, you can provide a format option to transform the datetime into the format of your choice:

    $builder
        ->add('title')
        ->add('shortcut')
        ->add('description')
        ->add('category')
        ->add('release_date', 'date', array(
            'input' => 'datetime',
            'widget' => 'choice',
            'format' => 'yMMMMd',
        ));
    

    This will print a select box for the year, e.g. 2012, one for the month with the long month names, and one for the day, e.g. 21. Take a look here for more formats.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've recently ran into a very interesting problem while writing a web app with
I'm currently playing around with tipfy on Google's Appengine and just recently ran into
I recently ran into a quite complex problem and after looking around a lot
I just recently ran into the Search with Pattern tool in the new ReSharper.
Recently, I ran into a problem with my application: the size of the JSON
I just recently started learning and using the ADO.NET Entity Framework and ran into
Hey guys i've just recently been getting a hang of sockets but ran into
I've been working on an extension recently. However, I just ran into a snag,
Just ran into this recently and I thought it'd be helpful to share. The
I have been using Automapper in our projects and just recently ran into an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.