Constructor
new module:ct-trading /validation /Date Validator(fields, date Patternopt, force Futureopt)
The constructor for the DateValidator
.
Extends:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
fields |
Array | An array of string field names that must be present in the data to validate. Must not be null. |
||
datePattern |
String |
<optional> |
A string representing the pattern of the date format to recognise. |
|
forceFuture |
boolean |
<optional> |
false | True indicates that the validator should only allow dates that are in the future. |
Extends
Methods
validate(oData ToValidate, oValidation Result)
Validates the supplied data and adds an error map to the validation result if any of the fields are missing, or if the implementing validator deems that the field contains an error. The error object is a map with the field name as the key and the error as the value. Implementing classes should not override this method.
Parameters:
Name | Type | Description |
---|---|---|
oDataToValidate |
module:ct-trading |
The data to validate. Must not be null or undefined. |
oValidationResult |
module:ct-trading |
A |
- Inherited From:
validate Field(value)
Performs a validation on the specified field value to determine if it is a valid date.
Parameters:
Name | Type | Description |
---|---|---|
value |
String | The field value to validate. |
Returns:
An error message indicating the validation failure, or null if no errors occurred.