Permalink
Browse files

BUGFIX More common defaults for en_US.xml used by Zend_DateFormat (an…

…d DateField/DatetimeField), with less error prone numerical format replacing the Zend default of shortened month names (fixes #6071, thanks dalesaurus)

BUGFIX Correct locale mapping in DateField_View_JQuery for "en_US" and "en_NZ"
MINOR Fixed form validation message in DateField to include actual date format, rather than a hardcoded value (from r111843)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112928 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
1 parent 5e0b978 commit 89c3349a1c72d321afa0dbde9f0517fa38c0415d @sminnee sminnee committed Oct 19, 2010
Showing with 72 additions and 3 deletions.
  1. +7 −2 forms/DateField.php
  2. +1 −1 lang/en_US.php
  3. +64 −0 thirdparty/Zend/Locale/Data/en_US.xml
View
@@ -210,8 +210,11 @@ function jsValidation() {
if(Validator::get_javascript_validator_handler() == 'none') return true;
if($this->getConfig('dmyfields')) {
- $error = _t('DateField.VALIDATIONJS', 'Please enter a valid date format (DD/MM/YYYY).');
- $error = 'Please enter a valid date format (DD/MM/YYYY) from dmy.';
+ $error = _t('DateField.VALIDATIONJS', 'Please enter a valid date format.');
+ // Remove hardcoded date formats from translated strings
+ $error = preg_replace('/\(.*\)/', '', $error);
+ $error .= ' (' . $this->getConfig('dateformat') .')';
+
$jsFunc =<<<JS
Behaviour.register({
"#$formID": {
@@ -497,6 +500,8 @@ class DateField_View_JQuery {
*/
static $locale_map = array(
'en_GB' => 'en-GB',
+ 'en_US' => 'en-US',
+ 'en_NZ' => 'en-GB',
'fr_CH' => 'fr-CH',
'pt_BR' => 'pt-BR',
'sr_SR' => 'sr-SR',
View
@@ -150,7 +150,7 @@
$lang['en_US']['Date']['YEARS'] = ' years';
$lang['en_US']['DateField']['NOTSET'] = 'not set';
$lang['en_US']['DateField']['TODAY'] = 'today';
-$lang['en_US']['DateField']['VALIDATIONJS'] = 'Please enter a valid date format (DD/MM/YYYY).';
+$lang['en_US']['DateField']['VALIDATIONJS'] = 'Please enter a valid date format.';
$lang['en_US']['DateField']['VALIDDATEFORMAT'] = 'Please enter a valid time format.';
$lang['en_US']['DateField']['VALIDDATEFORMAT2'] = 'Please enter a valid date format (%s)';
$lang['en_US']['DateField']['VALIDDATEMAXDATE'] = 'Your date has to be older or matching the maximum allowed date (%s)';
@@ -7,4 +7,68 @@
<language type="en"/>
<territory type="US"/>
</identity>
+ <dates>
+ <calendars>
+ <calendar type="gregorian">
+ <dateFormats>
+ <dateFormatLength type="full">
+ <dateFormat>
+ <pattern>EEEE, d MMMM yyyy</pattern>
+ </dateFormat>
+ </dateFormatLength>
+ <dateFormatLength type="long">
+ <dateFormat>
+ <pattern>d MMMM yyyy</pattern>
+ </dateFormat>
+ </dateFormatLength>
+ <dateFormatLength type="medium">
+ <dateFormat>
+ <pattern>MM/dd/yyyy</pattern>
+ </dateFormat>
+ </dateFormatLength>
+ <dateFormatLength type="short">
+ <dateFormat>
+ <pattern>MM/dd/yyyy</pattern>
+ </dateFormat>
+ </dateFormatLength>
+ </dateFormats>
+ <timeFormats>
+ <timeFormatLength type="full">
+ <timeFormat>
+ <pattern>HH:mm:ss v</pattern>
+ </timeFormat>
+ </timeFormatLength>
+ <timeFormatLength type="long">
+ <timeFormat>
+ <pattern>HH:mm:ss z</pattern>
+ </timeFormat>
+ </timeFormatLength>
+ <timeFormatLength type="medium">
+ <timeFormat>
+ <pattern>hh:mm a</pattern>
+ </timeFormat>
+ </timeFormatLength>
+ <timeFormatLength type="short">
+ <timeFormat>
+ <pattern>hh:mm a</pattern>
+ </timeFormat>
+ </timeFormatLength>
+ </timeFormats>
+ </calendar>
+ </calendars>
+ <timeZoneNames>
+ <metazone type="America_Eastern">
+ <commonlyUsed>true</commonlyUsed>
+ </metazone>
+ <metazone type="America_Central">
+ <commonlyUsed>true</commonlyUsed>
+ </metazone>
+ <metazone type="America_Mountain">
+ <commonlyUsed>true</commonlyUsed>
+ </metazone>
+ <metazone type="America_Pacific">
+ <commonlyUsed>true</commonlyUsed>
+ </metazone>
+ </timeZoneNames>
+ </dates>
</ldml>

0 comments on commit 89c3349

Please sign in to comment.