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

Control Panel not showing dates or date/time pickers in user's locale #2439

Closed
juresrpcic opened this issue Feb 15, 2018 · 8 comments
Closed

Comments

@juresrpcic
Copy link

Description

I have a few date fields in the CP (date pickers only, no time). Despite having a default locale set in config\general.php:

'defaultCpLanguage' => 'en_gb',

and also all users having selected their locale to "English (United Kingdom)", all date fields still show US formatting (month/date/year). The same formatting is shown when viewing date field as a custom column in CP lists.

Is there another place where I could set date fields to follow a selected locale? Ideally, they'd follow what the user has set.

I also tried changing my user's locale to German - everything changed in the CP except for dates which are still en_us formatted.

Steps to reproduce

  1. Create a date field
  2. Set user's locale to non-US
  3. See that dates and date pickers in CP still formated to US date
  4. Despair at US date formatting

Additional info

  • Craft version: 3.0.0-RC10.1
  • PHP version: PHP 7.1.10 (cli) (built: Oct 4 2017 08:54:01)
  • Database driver & version: MySQL 5.7.19
  • Plugins & versions: A fair few
@brandonkelly
Copy link
Member

I wasn’t able to reproduce this so I can’t say for sure, but noticed some issues with that defaultCpLanguage config setting implementation that could have been the culprit. Just fixed them in b17c61b.

Can you try changing your craftcms/cms version requirement in composer.json to "dev-develop as 3.0.0-RC99", and then run composer update and let me know if it works for you now?

@juresrpcic
Copy link
Author

I updated to latest dev-develop version but still have the same issue. Should I submit an issue and include logs/db?

Thanks.

@juresrpcic
Copy link
Author

Update - tried uninstalling plugins one-by-one and discovered that Matrix Colors are causing this. If I disable that plugin, everything behaves again (can also change to German time properly). Still works if I rollback to 3.0.0-RC10.1.

I'll report this as an issue on https://github.com/doublesecretagency/craft-matrixcolors . @lindseydiloreto

@brandonkelly
Copy link
Member

Ah very strange. @lindseydiloreto let me know if you need help debugging.

@lindseydiloreto
Copy link
Contributor

Strange indeed. Thanks guys, I'll follow up with this on the Matrix Colors repo. 👍

doublesecretagency/craft-matrixcolors#11

@lindseydiloreto
Copy link
Contributor

So it turns out this might be a Craft bug after all, @brandonkelly.

Steps to reproduce:

  1. Create a plugin which uses an Asset Bundle.
  2. Add the following to the Asset Bundle...
use craft\web\assets\cp\CpAsset;

And within the init method...

$this->depends = [CpAsset::class];
  1. Notice that all dates in the CP are being forced to US format.

brandonkelly added a commit that referenced this issue Feb 17, 2018
Reverts 253e97f, but doesn't seem like that order of operations is needed anymore, based on testing. (Could be wrong though, in which case we'll need to revisit.)
@brandonkelly
Copy link
Member

Thanks @lindseydiloreto! All fixed now for the next release.

@lindseydiloreto
Copy link
Contributor

Awesome, thanks @brandonkelly!

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

No branches or pull requests

3 participants