sfDateValidator: Range support

April 7, 2007

I finished implementing range support into sfDateValidator. You can now specify a range in which the entered date must be. Get it here.

Example:

fields:
  date:
    required:
      msg: This field is required
    sfDateValidator:
      range_start: "now"
      range_end: "+1 week"
      compare: date2
      operator: "<"
  date2:
    sfDateValidator:

This would check if date1 is greater than the current time (now) and within the next 7 days (1 week) but smaller than the date entered in the date2 field.

Of course, all strtotime values are supported.
If you don’t declare the range_end parameter, the validator would just check if the entered date is greater than range_start.

Advertisements

4 Responses to “sfDateValidator: Range support”

  1. Markus Says:

    did you thought about proposing your datevalidator to the symfony core…?

  2. symfoniac Says:

    Sure, but first i want to make it complete – there are still some small things to do.
    When it’s ready i’ll propose it ;)

  3. Markus Says:

    do you have a todo list online?
    is the sourcecode browsable anywhere?

    thanks for your work,
    Markus

  4. symfoniac Says:

    Well, i have thought about the following:
    – rename range_* to min/max
    – UnitTest
    – != Operator

    what do you mean with “sourcecode browsable”?


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: