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

API Default to "yyyy-MM-dd" for date format #2841

Merged
merged 1 commit into from
Feb 17, 2014

Conversation

chillu
Copy link
Member

@chillu chillu commented Feb 11, 2014

The motivation for this was to avoid using "MMM" in particular, since it causes inconsistencies in month
names between jQuery UI and Zend_Locale_Format.
One example of that was "mar." (jQuery UI( vs. "mars" (Zend_Locale) as a danish short month name.

This means if you set a default locale of de_DE for example,
the date format will still be yyyy-MM-dd (rather than dd.MM.yyyy).
You still get that one as a suggestion in the member profile,
and can set it as a global default through i18n.date_format config API,
its just not auto detected any longer. This also makes i18n::get_date_format()
obsolete, since we can now simply use the Config API without any dynamic calls.

I've implemented the same changes for consistency in time_format as well.

Fixes silverstripe/silverstripe-cms#544

@halkyon
Copy link
Contributor

halkyon commented Feb 11, 2014

I've merged in fixes for PHPUnit from 3.1 branch so Travis should work on pull requests against master now.

Anyway, there's some failures in the current tests. I've cherry picked the commit from this pull onto the latest HEAD of master, ran the tests and got these failures:

  1. MemberDatetimeOptionsetFieldTest::testDateFormatDefaultCheckedInFormField
    Failed asserting that two strings are equal.
    --- Expected
    +++ Actual
    @@ @@
    -'checked'
    +''

/Users/sharvey/Sites/ssmaster-dev/framework/tests/forms/MemberDatetimeOptionsetFieldTest.php:52
/Users/sharvey/.composer/vendor/phpunit/phpunit/composer/bin/phpunit:63

  1. i18nTest::testDateFormatFromLocale
    Failed asserting that null matches expected 'MMM d, y'.

/Users/sharvey/Sites/ssmaster-dev/framework/tests/i18n/i18nTest.php:70
/Users/sharvey/.composer/vendor/phpunit/phpunit/composer/bin/phpunit:63

  1. i18nTest::testDateFormatCustom
    Failed asserting that null matches expected 'MMM d, y'.

/Users/sharvey/Sites/ssmaster-dev/framework/tests/i18n/i18nTest.php:86
/Users/sharvey/.composer/vendor/phpunit/phpunit/composer/bin/phpunit:63

  1. MemberTest::testMemberWithNoDateFormatFallsbackToGlobalLocaleDefaultFormat
    Failed asserting that null matches expected 'MMM d, y'.

/Users/sharvey/Sites/ssmaster-dev/framework/tests/security/MemberTest.php:324
/Users/sharvey/.composer/vendor/phpunit/phpunit/composer/bin/phpunit:63

  1. MemberTest::testMemberWithNoDateFormatFallsbackToTheirLocaleDefaultFormat
    Failed asserting that null matches expected 'dd.MM.yyyy'.

/Users/sharvey/Sites/ssmaster-dev/framework/tests/security/MemberTest.php:330
/Users/sharvey/.composer/vendor/phpunit/phpunit/composer/bin/phpunit:63

Default to "yyyy-MM-dd" for date format, and "H:mm" for time_format.
Switched to config API for setting/getting values.

Avoid using "MMM" in particular, since it causes
inconsistencies in month names between jQuery UI and Zend_Locale_Format.

Fixes silverstripe/silverstripe-cms#544
@chillu
Copy link
Member Author

chillu commented Feb 16, 2014

Thanks for reviewing, Sean! Builds should be passing now, sorry for that mess. I've applied the same changes to time_format, and rejiggered the code a bit - would you mind having another look?

halkyon added a commit that referenced this pull request Feb 17, 2014
API Default to "yyyy-MM-dd" for date format
@halkyon halkyon merged commit 03f1456 into silverstripe:master Feb 17, 2014
@chillu chillu deleted the pulls/dateformat-simplified branch February 16, 2017 22:03
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

Successfully merging this pull request may close these issues.

2 participants