Open fnogatz opened 1 year ago
Hello ! I discovered this bug yesterday, and was about to send an mail about it :wink: What a coincidence !
From my part, i analyzed that it came from the locale sent in the HTTP headers Accept-Language
, by the browser.
If no format is given to Zend_Date
, it will try to guess it, and it does it through the priority given in Accept-Language
: everything was fine when fr_FR
was firt, but if it was not in, or after en_US
, i had the same bugs !
It's a very dangerous bug, because if you edit the retailer for another thing than the opening hours, and you don't notice they are not ok, you could possibly corrupt the data on save ! And if you have a shipping method using those hours... :cry:
Thx a lot for this fix !
@fnogatz Hello ! Any news on when it would be merged and deployed ?
Thx :smile:
No idea when the Smile folks will look into this, sorry :innocent:
In the meantime, you could apply this patch via composer patches.
Maybe @PrigentMatthieu or @Coosos can help out getting this merged?
I sent a message to my colleague :)
Thank you, @Coosos. Did you get any response?
In the Adminhtml's
Renderer.php
, the call of$this->date->date()->format('Y-m-d')
correctly returns the string2023-02-06
for today, February 6th of 2023. However, in installations with a different locale (likede_DE
), this is wrongly interpreted as June 2nd of 2023 by theZend_Date()
constructor. For every date that might possibly be parsed both ways, this results in the problems described in #91 and #124: the set opening hours are incorrectly displayed at the very right of the range bar. If you look closely, you will notice that this problem was reported to be "magically gone" only after the 12th day of a month has passed, since this takes away the ambiguity in the date parsing process.This PR explicitly states the date format of the given string, so it is parsed correctly independently on the set locale. It is more straightforward than my original proposal from three years ago in https://github.com/Smile-SA/magento2-module-store-locator/issues/91#issue-578937698.