Forums

Covering OroCommerce topics, B2B eCommerce trends, community updates and company announcements.

Forums OroCommerce Date wrong and datepicker error in locale pt_BR

This topic contains 4 replies, has 2 voices, and was last updated by mario.pinho mario.pinho 1 month, 1 week ago.

  • Creator
    Topic
  • #31722
    mario.pinho
    mario.pinho
    Participant

    Hi,

    In locale pt_BR, dates are been displayed incorrectly. Dates are been displayed as “06 De jun De 2018” when the correct is “06 de jun de 2018” as per PHP IntlDateFormatter. While it is not a big deal, the real problem is in datepicker thats picks a wrong date, as below:
    datepicker error

    Inspecting code generate, you can see the locale.settings variable has a wrong values for jquery_ui, moment and php (intl is fine):

    Where the correct should be:

    May I missing something in configuration?

    Also, how can I chance default format for a pattern like ‘dd/MM/yyyy’ in whole site context?

    Regards,

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
    Replies
  • #31734
    msulima
    msulima
    Moderator

    Hi, mario.pinho.

    I made little debug and discovered that it is bug in AbstractDateTimeFormatConverter class.
    Probably you can temporary fix this bug by adding

    to formatting array https://github.com/oroinc/platform/blob/2.6/src/Oro/Bundle/LocaleBundle/Converter/AbstractDateTimeFormatConverter.php#L23.

    how can I chance default format for a pattern like ‘dd/MM/yyyy’ in whole site context?

    As I know now you can’t do that for all application.


    #31745
    mario.pinho
    mario.pinho
    Participant

    Hi, msulima!

    Your suggestion is not fully operational, it only removes word “de” from format and it is not correct. In portuguese and spanish (may be in some other languages) the preposition “de” (“of” in english) is necessary for FULL and MEDIUM formats, so I suggest the function convertFormat as follow:

    The ideia is tokenize the format e convert only tokens present in formatMatch. I do this directly in AbstractDateTimeFormatConverter, and remove convertFormat from PhpDateTimeFormatConverter and JqueryUiDateTimeFormatConverter because chars ‘ and ” are necessary. MomentDateTimeFormatConverter is fine. Now, everything is working correctly.

    Now, I’m facing a different problem. Im my Bundle, I create an extension as described in “How to Extend Existing Bundle” for classes AbstractDateTimeFormatConverter, PhpDateTimeFormatConverter and JqueryUiDateTimeFormatConverter, made de changes in services.yml but it is not working. I tried to extend de classes and make new ones, no success. For sure, I’m missing something. Can you help me what must I do to extend these classes?

    #31746
    msulima
    msulima
    Moderator
    #31760
    mario.pinho
    mario.pinho
    Participant

    My bundles.yml:

    My services.yml:

    • This reply was modified 1 month, 1 week ago by mario.pinho mario.pinho.
Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

You will be redirected to [title]. Would you like to continue?

Yes No
ssossossosso