protected function configure($options = array(), $messages = array()) { $this->addOption('with_meridiem', false); parent::configure($options, $messages); // setting option "date_format_range_error" because the format in sfValidatorDate is unreadable. $this->setOption('date_format_range_error', 'F jS, Y'); }
/** * Configures the current validator. * * Available options: * * * date_format: A regular expression that dates must match * * with_time: true if the validator must return a time, false otherwise * * date_output: The format to use when returning a date (default to Y-m-d) * * datetime_output: The format to use when returning a date with time (default to Y-m-d H:i:s) * * date_format_error: The date format to use when displaying an error for a bad_format error (use date_format if not provided) * * max: The maximum date allowed (as a timestamp) * * min: The minimum date allowed (as a timestamp) * * date_format_range_error: The date format to use when displaying an error for min/max (default to d/m/Y H:i:s) * * Available error codes: * * * bad_format * * min * * max * * @param array $options An array of options * @param array $messages An array of error messages * * @see sfValidatorBase */ protected function configure($options = array(), $messages = array()) { parent::configure($options, $messages); $i18n = dm::getI18n(); $this->addMessage('bad_format', '"%value%" ' . $i18n->__('does not match the date format') . ' (%date_format%).'); $this->addMessage('max', $i18n->__('The date must be before') . ' %max%.'); $this->addMessage('min', $i18n->__('The date must be after') . ' %min%.'); // $this->addOption('date_format', $this->getDateFormat(dm::getUser()->getCulture())); $this->addOption('context', dmContext::getInstance()); }
/** * Configures the current validator. * * Available options from sfValidatorDate: * * * date_format: A regular expression that dates must match * * with_time: true if the validator must return a time, false otherwise * * date_output: The format to use when returning a date (default to Y-m-d) * * datetime_output: The format to use when returning a date with time (default to Y-m-d H:i:s) * * date_format_error: The date format to use when displaying an error for a bad_format error (use date_format if not provided) * * max: The maximum date allowed (as a timestamp) * * min: The minimum date allowed (as a timestamp) * * from_date: true if the date to validate is a begin date, false if an end date in a range * * date_format_range_error: The date format to use when displaying an error for min/max (default to d/m/Y H:i:s) * * New options added for the fuzzyDateValidator: * * * from_date: A flag telling if the date entered is a from or a to date in a range of date: used to correct what is inserted * * Available error codes: * * * bad_format * * min * * max * * year_missing * * month_missing * * day_missing * * hour_missing * * minute_missing * * wrong_date_part_length * * @param array $options An array of options * @param array $messages An array of error messages * @see sfValidatorDate */ protected function configure($options = array(), $messages = array()) { $this->addMessage('year_missing', 'Year missing.'); $this->addMessage('month_missing', 'Month missing or remove the day and time.'); $this->addMessage('day_missing', 'Day missing or remove the time.'); $this->addMessage('hour_missing', 'Hour missing or remove the time.'); $this->addMessage('minute_missing', 'minute missing or remove the seconds.'); $this->addMessage('time_without_date', 'Day missing or remove the time.'); $this->addMessage('wrong_date_part_length', 'A part of date is wrong.'); $this->addOption('from_date', true); parent::configure($options, $messages); }
protected function configure($options = array(), $messages = array()) { parent::configure($options, $messages); $this->addOption('date_separator', '/'); }
/** * @see sfValidatorDate */ protected function configure($options = array(), $messages = array()) { parent::configure($options, $messages); $this->setOption('with_time', true); }
/** * Configures the current validator. * * @param array $options An array of options * @param array $messages An array of error messages * * @see sfValidatorBase */ public function configure($options = array(), $messages = array()) { parent::configure($options, $messages); $this->setOption('date_format', sfWidgetFormInputDate::getRegexp()); $this->setOption('date_format_error', sfWidgetFormInputDate::getDateFormat()); }
/** * Configure the validator. Adding two more options to the regular validator * input_date_format : date format from the form's input. Default is Y-m-d (ex: 2009-08-19) * output_date_format : date format to get as output * Allowed format masks: * d : 01 to 31 * m : 01 to 12 * y : 00 to 99 * Y : example 2009 * Allowed format separators: /-_,. and space * @see trunk/lib/vendor/symfony/lib/validator/sfValidatorDate#configure($options, $messages) */ protected function configure($options = array(), $messages = array()) { $this->addOption('input_date_format', 'Y-m-d'); $this->addOption('output_date_format', 'Y-m-d'); parent::configure($options, $messages); }
/** * Configures the current validator. * * Available options: * * * date_format: A regular expression that dates must match * * with_time: true if the validator must return a time, false otherwise * * date_output: The format to use when returning a date (default to Y-m-d) * * datetime_output: The format to use when returning a date with time (default to Y-m-d H:i:s) * * date_format_error: The date format to use when displaying an error for a bad_format error * (use date_format if not provided) * * max: The maximum date allowed (as a timestamp) * * min: The minimum date allowed (as a timestamp) * * date_format_range_error: The date format to use when displaying an error for min/max (default to d/m/Y H:i:s) * * context: The symfony application context * * Available error codes: * * * bad_format * * min * * max * * @param array $options An array of options * @param array $messages An array of error messages * * @see sfValidatorBase */ protected function configure($options = array(), $messages = array()) { $this->addOption('context', sfContext::getInstance()); parent::configure($options, $messages); }