Title: Validation for Date Range?
Last modified: August 31, 2016

---

# Validation for Date Range?

 *  Resolved [dkdelosreyes](https://wordpress.org/support/users/dkdelosreyes/)
 * (@dkdelosreyes)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/validation-for-date-range/)
 * I have two repeater field date “start_date” and “end_date” is it possible to 
   validate the “end_date” to be greater that the “start_date”?
 * Thanks in advance
 * [https://wordpress.org/plugins/validated-field-for-acf/](https://wordpress.org/plugins/validated-field-for-acf/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [doublesharp](https://wordpress.org/support/users/doublesharp/)
 * (@doublesharp)
 * [10 years ago](https://wordpress.org/support/topic/validation-for-date-range/#post-7319224)
 * Hi dkdelosreyes,
 * You can – you would just need to convert the values from their string representation
   to a Datetime or timestamp. For each field the `$value` variable contains the
   current field’s value, but you can access the other submitted fields using the`
   $inputs` array. Each array element is an array with the keys ‘field’, ‘value’,
   and ‘prev_value’.
 * Thanks!
 *  Thread Starter [dkdelosreyes](https://wordpress.org/support/users/dkdelosreyes/)
 * (@dkdelosreyes)
 * [10 years ago](https://wordpress.org/support/topic/validation-for-date-range/#post-7319248)
 * May I know how could I access the other field values, do you have some code snippets?
   I’m trying to access another validated field in a repeater field (start_date)
   to compare to my end_date.
 * Thanks!
 *  Plugin Author [doublesharp](https://wordpress.org/support/users/doublesharp/)
 * (@doublesharp)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/validation-for-date-range/#post-7319293)
 * [@dkdelosreyes](https://wordpress.org/support/users/dkdelosreyes/)
 * You should be able to do something like:
 *     ```
       for ( $inputs as $input ){
           if ( $input['field'] == 'the field i care about' ){
               if ( $input['value'] != $value ){
                   return "the date values don't match";
               }
               break;
           }
       }
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Validation for Date Range?’ is closed to new replies.

 * ![](https://ps.w.org/validated-field-for-acf/assets/icon-256x256.png?rev=1116693)
 * [Advanced Custom Fields: Validated Field](https://wordpress.org/plugins/validated-field-for-acf/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/validated-field-for-acf/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/validated-field-for-acf/)
 * [Active Topics](https://wordpress.org/support/plugin/validated-field-for-acf/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/validated-field-for-acf/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/validated-field-for-acf/reviews/)

## Tags

 * [date range](https://wordpress.org/support/topic-tag/date-range/)
 * [validation](https://wordpress.org/support/topic-tag/validation/)

 * 3 replies
 * 2 participants
 * Last reply from: [doublesharp](https://wordpress.org/support/users/doublesharp/)
 * Last activity: [9 years, 10 months ago](https://wordpress.org/support/topic/validation-for-date-range/#post-7319293)
 * Status: resolved