OroCommerce Forums

Covering OroCommerce topics, including community updates and company announcements.

Forums 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 5 years, 10 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
    Topic
  • #33083

    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
  • #33084

    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.


    #33085

    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?

    #33086

    msulima
    Moderator
    #33087

    mario.pinho
    Participant

    My bundles.yml:

    My services.yml:

    • This reply was modified 5 years, 10 months ago by  mario.pinho.
Viewing 4 replies - 1 through 4 (of 4 total)

The forum ‘OroCommerce’ is closed to new topics and replies.

Back to top