Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date discreapncies between Formatter::asDate() and FormatConverter::convertDateIcuToJui() discrepancies #9312

Closed
tom-- opened this issue Aug 4, 2015 · 8 comments
Assignees
Labels

Comments

@tom--
Copy link
Contributor

tom-- commented Aug 4, 2015

I noticed the following differences when using jQuery-UI Datepicker. Formatter was providing the date input's initial value on page load and the format changed after using Datepicker.

Both are ICU 'medium'.

locale asDate() convertDateIcuToJui()
en-US Apr 4, 2015 Apr 4 2015
ru-RU 04 авг. 2015 г. 04 Авг 2015 г.

or something like that

@cebe cebe added the status:to be verified Needs to be reproduced and validated. label Aug 4, 2015
@cebe cebe added this to the 2.0.7 milestone Aug 4, 2015
@cebe cebe self-assigned this Aug 4, 2015
@cebe cebe modified the milestones: 2.0.x, 2.0.7 Dec 17, 2015
@cebe
Copy link
Member

cebe commented Nov 27, 2016

I am unable to reproduce this, do you have the PHP intl extension installed?

@cebe cebe added status:need more info and removed status:to be verified Needs to be reproduced and validated. labels Nov 27, 2016
@tom--
Copy link
Contributor Author

tom-- commented Nov 27, 2016

The discrepancy has changed since I last tested it.

intl 1.1.0
ICU 52.1
PHP 7.0.11

In app config

    'language' => 'ru-RU',

Model and controller

<?php

class TestForm extends \yii\base\Model
{
    public $date = '2016-11-27';
}

class TestController extends \yii\web\Controller
{
    public function actionTest()
    {
        return $this->render('test', ['model' => new TestForm()]);
    }
}

View

<?php $form = \yii\widgets\ActiveForm::begin(); ?>
<?= $form->field($model, 'date')->widget(\yii\jui\DatePicker::className(), ['dateFormat' => 'medium']) ?>
<?php \yii\widgets\ActiveForm::end(); ?>

Initial page load

Alt text

Click on 27 Nov in the date picker

Alt text

Date is now formatted as

Alt text

@tom--
Copy link
Contributor Author

tom-- commented Nov 27, 2016

i cannot be sure that intl was installed when i ran the test in aug last year but it most likely was because i have required it as standard for years

@cebe cebe modified the milestones: 2.0.12, 2.0.x Nov 28, 2016
@cebe cebe modified the milestones: 2.0.13, 2.0.12 Apr 25, 2017
@bscheshirwork
Copy link
Contributor

confirm now

bower-asset/bootstrap                   v3.3.7            
bower-asset/highcharts                  v5.0.14           
bower-asset/inputmask                   3.3.10            
bower-asset/jquery                      3.2.1             
bower-asset/jquery-ui                   1.11.4            
bower-asset/punycode                    v1.3.2            
bower-asset/typeahead.js                v0.11.1           
bower-asset/yii2-pjax                   2.0.7.1           
yiisoft/yii2                            dev-master 1ad69de Yii PHP Framework Version 2
yiisoft/yii2-jui                        dev-master 75e6f78 The Jquery UI extension for the Yii framework

php: 7.1.10-fpm-alpine-4yii2-xdebug

intl 1.1.0 

ICU version => 57.1
ICU Data version => 57.1
requirements.php
ICU version: OK
ICU Data version: OK
<?php
\Yii::$app->language = 'ru';
class TestForm extends \yii\base\Model
{
    public $date = '2017-10-25';
}
$model = new TestForm;
$form = \yii\widgets\ActiveForm::begin();
?>
<?= $form->field($model, 'date')->widget(\yii\jui\DatePicker::className(), ['dateFormat' => 'medium']) ?>
<?php \yii\widgets\ActiveForm::end(); ?>

peek 2017-10-25 12-19

@cebe
Copy link
Member

cebe commented Oct 25, 2017

@bscheshirwork thanks for the detailed research. I just looked into the jquery UI sources and found that they have hardcoded the month names:

https://github.com/jquery/jquery-ui/blob/74f8a0ac952f6f45f773312292baef1c26d81300/ui/i18n/datepicker-ru.js#L22-L23

@bscheshirwork
Copy link
Contributor

@cebe
So... This issue can be moved to yiisoft/yii2-jui and can be remove from milestone 2.0.13?

@yii-bot
Copy link

yii-bot commented Oct 26, 2017

Issue moved to yiisoft/yii2-jui#70

@yii-bot yii-bot closed this as completed Oct 26, 2017
@cebe
Copy link
Member

cebe commented Oct 26, 2017

So... This issue can be moved to yiisoft/yii2-jui and can be remove from milestone 2.0.13?

yep, thanks for noting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants