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

Month picker #81

Open
lionelbzv opened this issue Jun 21, 2018 · 2 comments
Open

Month picker #81

lionelbzv opened this issue Jun 21, 2018 · 2 comments

Comments

@lionelbzv
Copy link
Contributor

Can I customize the "date picker" to have only a "month picker"?

Something like this

@bobvandevijver
Copy link
Member

You should be able to set the format option of the picker to whatever format you need. However, note the differences between the PHP format and the JS format!

@lionelbzv
Copy link
Contributor Author

If I set a format option in my Object-generator.yml file, I've got an Exception: every format except yyyy-MM-dd throws this Exception.

    new:
        params:
            title:                              "New object"
            display:
                "Dates field":            [ begin_at ]
            fields:
                begin_at:
                    formType:                   Admingenerator\FormExtensionsBundle\Form\Type\DatePickerType
                    addFormOptions:
                        format:                 yyyy-MM

Exception:

The option "format" with value "yyyy-MM" is invalid. Accepted values are: "yyyy-MM-dd".

Stack trace:

Symfony\Component\OptionsResolver\Exception\InvalidOptionsException: The option "format" with value "yyyy-MM" is invalid. Accepted values are: "yyyy-MM-dd".
    at n/a
        in /myproject/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/OptionsResolver.php line 924

    at Symfony\Component\OptionsResolver\OptionsResolver->offsetGet('format')
        in /myproject/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/OptionsResolver.php line 773

    at Symfony\Component\OptionsResolver\OptionsResolver->resolve(array('label' => 'Début', 'translation_domain' => 'Admin', 'required' => false, 'format' => 'yyyy-MM'))
        in /myproject/vendor/symfony/symfony/src/Symfony/Component/Form/ResolvedFormType.php line 156

    at Symfony\Component\Form\ResolvedFormType->createBuilder(object(FormFactory), 'begin_at', array('label' => 'Début', 'translation_domain' => 'Admin', 'required' => false, 'format' => 'yyyy-MM'))
        in /myproject/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/DataCollector/Proxy/ResolvedTypeDataCollectorProxy.php line 82

    at Symfony\Component\Form\Extension\DataCollector\Proxy\ResolvedTypeDataCollectorProxy->createBuilder(object(FormFactory), 'begin_at', array('label' => 'Début', 'translation_domain' => 'Admin', 'required' => false, 'format' => 'yyyy-MM'))
        in /myproject/vendor/symfony/symfony/src/Symfony/Component/Form/FormFactory.php line 107

    at Symfony\Component\Form\FormFactory->createNamedBuilder('begin_at', object(ResolvedTypeDataCollectorProxy), null, array('label' => 'Début', 'translation_domain' => 'Admin', 'required' => false, 'format' => 'yyyy-MM'))
        in /myproject/vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php line 106

    at Symfony\Component\Form\FormBuilder->create('begin_at', 'Admingenerator\FormExtensionsBundle\Form\Type\DatePickerType', array('label' => 'Début', 'translation_domain' => 'Admin', 'required' => false, 'format' => 'yyyy-MM'))
        in /myproject/vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php line 269

    at Symfony\Component\Form\FormBuilder->resolveChildren()
        in /myproject/vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php line 215

    at Symfony\Component\Form\FormBuilder->getForm()
        in /myproject/vendor/symfony/symfony/src/Symfony/Component/Form/FormFactory.php line 33

    at Symfony\Component\Form\FormFactory->create('App\AdminBundle\Form\Type\Project\NewType', object(Project), array())
        in /myproject/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php line 282

    at Symfony\Bundle\FrameworkBundle\Controller\Controller->createForm('App\AdminBundle\Form\Type\Project\NewType', object(Project), array())
        in /myproject/app/cache/dev/Admingenerated/AppAdminBundle/BaseProjectController/NewController.php line 240

    at Admingenerated\AppAdminBundle\BaseProjectController\NewController->getNewForm(object(Project))
        in /myproject/app/cache/dev/Admingenerated/AppAdminBundle/BaseProjectController/NewController.php line 21

    at Admingenerated\AppAdminBundle\BaseProjectController\NewController->indexAction(object(Request))
        in /myproject/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php line 135

    at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), '1')
        in /myproject/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php line 57

    at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), '1', true)
        in /myproject/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/ContainerAwareHttpKernel.php line 67

    at Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->handle(object(Request), '1', true)
        in /myproject/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php line 183

    at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
        in /myproject/web/app_dev.php line 30

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