StartEndDate plugin

Validate start and end dates

Usage

The following piece of code is the starting point to use the StartEndDate plugin:

The sample code above assumes that the FormValidation files are placed inside the vendors directory. You might need to change the path depending on where you place them on the server.

Options

* presents a required option

Option Type Description
format * String The date format that both start and end dates have to follow. It's the same as the format option provided by the date validator
startDate * Object Contains two require properties:
  • field (String): The name of start date field
  • message (String): The message when the start date is not a valid date or not ealier than the end date
endDate * Object Contains two require properties:
  • field (String): The name of end date field
  • message (String): The message when the end date is not a valid date or not later than the start date

You don't have to define the date validator rules for start and end date fiels, because it's handled by the StartEndDate plugin automatically.

Basic example

Changelog

  • v1.1.0: First release. It means that the StartEndDate plugin requires FormValidation v1.1.0 or newer.

More examples

Related validators

The following validators might be useful to you.