Class
caplin.trading.validation

DateValidator

The DateValidator is a caplin.trading.validation.Validator that provides functions to ensure supplied data contains valid dates.
The DateValidator uses the Moment.js JavaScript library (http://momentjs.com) for date parsing. Refer to the Moment.js JS API documentation for further details of the pattern characters.

Constructor Summary

Attributes Name and Description
caplin.trading.validation.DateValidator(Array l_pMandatoryFields, String sDatePattern, boolean l_pMustBeFuture)

The constructor for the DateValidator.

Method Summary

Attributes Name and Description
String validateField(String sFieldValue)

Performs a validation on the specified field value to determine if it is a valid date.

Methods inherited from class caplin.trading.validation.AbstractFieldValidator:
validate

Constructor Detail

caplin.trading.validation.DateValidator(Array l_pMandatoryFields, String sDatePattern, boolean l_pMustBeFuture)

The constructor for the DateValidator.

Parameters
Array l_pMandatoryFields An array of string field names that must be present in the data to validate. Must not be null.
String sDatePattern An optional string representing the pattern of the date format to recognise.
boolean l_pMustBeFuture Optional. True indicates that the validator should only allow dates that are in the future. Defaults to false.

Method Detail

String validateField(String sFieldValue)

Performs a validation on the specified field value to determine if it is a valid date.

Parameters
String sFieldValue The field value to validate.
Returns
An error message indicating the validation failure, or null if no errors occurred.