YYYY = ' . _t('MemberDatetimeOptionsetField.FOURDIGITYEAR', 'Four-digit year',
40, 'Help text describing what "YYYY" means in ISO date formatting') . '
'
. '
YY = ' . _t('MemberDatetimeOptionsetField.TWODIGITYEAR', 'Two-digit year',
40, 'Help text describing what "YY" means in ISO date formatting') . '
'
. '
MMMM = ' . _t('MemberDatetimeOptionsetField.FULLNAMEMONTH', 'Full name of month (e.g. June)',
40, 'Help text describing what "MMMM" means in ISO date formatting') . '
'
. '
MMM = ' . _t('MemberDatetimeOptionsetField.SHORTMONTH', 'Short name of month (e.g. Jun)',
40, 'Help text letting describing what "MMM" means in ISO date formatting') . '
'
. '
MM = ' . _t('MemberDatetimeOptionsetField.TWODIGITMONTH', 'Two-digit month (01=January, etc.)',
40, 'Help text describing what "MM" means in ISO date formatting') . '
'
. '
M = ' . _t('MemberDatetimeOptionsetField.MONTHNOLEADING', 'Month digit without leading zero',
40, 'Help text describing what "M" means in ISO date formatting') . '
'
. '
dd = ' . _t('MemberDatetimeOptionsetField.TWODIGITDAY', 'Two-digit day of month',
40, 'Help text describing what "dd" means in ISO date formatting') . '
'
. '
d = ' . _t('MemberDatetimeOptionsetField.DAYNOLEADING', 'Day of month without leading zero',
40, 'Help text describing what "d" means in ISO date formatting') . '
'
. '
hh = ' . _t('MemberDatetimeOptionsetField.TWODIGITHOUR', 'Two digits of hour (00 through 23)',
40, 'Help text describing what "hh" means in ISO date formatting') . '
'
. '
h = ' . _t('MemberDatetimeOptionsetField.HOURNOLEADING', 'Hour without leading zero',
40, 'Help text describing what "h" means in ISO date formatting') . '
'
. '
mm = ' . _t('MemberDatetimeOptionsetField.TWODIGITMINUTE',
'Two digits of minute (00 through 59)',
40, 'Help text describing what "mm" means in ISO date formatting') . '
'
. '
m = ' . _t('MemberDatetimeOptionsetField.MINUTENOLEADING', 'Minute without leading zero',
40, 'Help text describing what "m" means in ISO date formatting') . '
'
. '
ss = ' . _t('MemberDatetimeOptionsetField.TWODIGITSECOND',
'Two digits of second (00 through 59)',
40, 'Help text describing what "ss" means in ISO date formatting') . '
'
. '
s = ' . _t('MemberDatetimeOptionsetField.DIGITSDECFRACTIONSECOND',
'One or more digits representing a decimal fraction of a second',
40, 'Help text describing what "s" means in ISO date formatting') . '
'
. '
a = ' . _t('MemberDatetimeOptionsetField.AMORPM', 'AM (Ante meridiem) or PM (Post meridiem)',
40, 'Help text describing what "a" means in ISO date formatting') . '
'
. '
';
return $output;
}
public function setValue($value) {
if($value == '__custom__') {
$value = isset($_REQUEST[$this->name . '_custom']) ? $_REQUEST[$this->name . '_custom'] : null;
}
if($value) {
parent::setValue($value);
}
}
/**
* Validate this field
*
* @param Validator $validator
* @return bool
*/
public function validate(Validator $validator) {
$value = isset($_POST[$this->name . '_custom']) ? $_POST[$this->name . '_custom'] : null;
if(!$value) return true; // no custom value, don't validate
// Check that the current date with the date format is valid or not
require_once 'Zend/Date.php';
$date = Zend_Date::now()->toString($value);
$valid = Zend_Date::isDate($date, $value);
if($valid) {
return true;
} else {
if($validator) {
$validator->validationError($this->name,
_t('MemberDatetimeOptionsetField.DATEFORMATBAD',"Date format is invalid"), "validation", false);
}
return false;
}
}
}