Closed SanyaBeer closed 7 years ago
Datecontrol wraps Kartik's 'datePicker' widget which wraps bootstrap-datepicker.
This bootstrap datepicker has a set of formats components which it understands. Kartik's datePicker widget converts most used PHP format patterns to the requested format. Unfortunately bootstrap-datepicker doesn't know about Russian year. see: https://bootstrap-datepicker.readthedocs.io/en/latest/options.html#format
Also PHP doesn't know about this. see http://php.net/manual/de/function.date.php. But PHP has a command to convert Gregorian calendar to Julian calendar 'gregoriantojd'.
INTL library with ICU format is the most complex formatter which exists. There is such a know how of date, time, number, currency etc. formats.
As I understand it's not only a formatting issue. There must be a calculation rule like conversion from Julian to Gregorian calendar or Japanese to Gregorian calendar etc. This is complex. Best solution could be to remove the "r".
Yes as @Enrica-r says. There unfortunately cannot be enhancement for complex locale scripts as that may bloat this library. Solution is to use simpler date formats with just numeric part of the date-time parts (rather than expecting text translations) as much as possible.
I am closing this currently based on above.
I have some strange issue with russian locale.. I am use DateControl with default setting. Config settings:
And form usage:
Date format get from Yii formatter, by default it was "medium". Function "convertDateIcuToPhp(.....)" in \yii\helpers\BaseFormatConverter: "IntlDateFormatter()" give to us this pattern "d MMM y 'г'." (in pattern 'г' - it is like Year on russian :-)), after this we have some manipulation and convertDateIcuToPhp return to us this pattern: "j M Y \г."; Now DateControl::displayFormat = "j M Y \г."; And after assets:
We have two "\". Value in field set in "1 Май 2016 \г."
I have problem because with this setting, yii2-datecontrol/controllers/ParseController::actionConvert() return empty value.