symfony2admingenerator / AdmingeneratorGeneratorBundle

(old-legacy) Admingenerator for Symfony2, parse generator.yml files to build classes

Home Page:http://symfony2admingenerator.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

afe_date_picker format and List builder

enkaho opened this issue · comments

Hi,

First of all, I want to thanks you guys for this huge and awesome generator !

I'm using now avocode/FormExtensions, and i want to format date field rendering in edit form wiith this widget.

In the generator.yml :

fields: 
        start:
            formType: afe_date_picker
            addFormOptions:
                format: dd-MM-yyyy

I have an issue with list builder and the date format for my start field.
Indeed, afe_date_picker format and php date format are not the same...
afe_date_picker with format: dd-MM-yyyy rendering 20-06-2014 and in the list builder view this format rendering 0606-JunJun-14141414

How can i resolve this ?

Thx for your support.

@enkaho this issue belongs to AvocodeFormExtensionsBundle

the problem is, we use a javascript library (in this widget) which does not use PHP date's format

the possible solutions would be:

  • to modify that library
  • use some other library, which would use the same date formatting standard as PHP's date function
  • pass diffrent options to list builder and edit builder

For the first two solutions.. please open an issue at AvocodeFormExtensions.

Here I will describe a temporary solution you can use - in your generator.yml you can overwrite the form options for each builder:

params: # here you define a default value for ALL builders
    fields:
        start:
            formType: afe_date_picker
            addFormOptions:
                format: dd-MM-yyyy
builders:
    list:
        params: # here you can overwrite all settings just for this builder
            fields:
                start:
                    addFormOptions:
                        format: Y-m-d

This way all builders (show, new, edit, excel, actions) get format dd-MM-yyyy, only list builder gets Y-m-d.

Thanks you very much, i will post this issue to AvocodeFormExtensionsBundle.