Constructor
new DateRestrictionValidator(options)
Constructs a DateRestrictionValidator that ensures the value provided is not in a disabled entry of dayMetaData
Parameters:
| Name | Type | Argument | Description |
|---|---|---|---|
options |
oj.DateRestrictionValidator.ValidatorOptions |
<optional> |
an object literal used to provide the following properties |
Methods
-
getHint() → {string|null}
-
A message to be used as hint. As there exists no hint for DateRestrictionValidator, default is to return null.
Returns:
a hint message or null if no hint is available in the options- Type
- string | null
-
validate(value) → {string}
-
Validates whether the date provided is part of disabled date
Parameters:
Name Type Description valuestring that is being validated Throws:
when there is no match- Type
- Error
Returns:
original if validation was successful- Type
- string
Type Definitions
-
DayFormatterInput
-
Input type for the dayFormatter option call back function
Properties:
Name Type fullYearnumber monthnumber datenumber -
DayFormatterOutput
-
Output type for the dayFormatter option call back function
Properties:
Name Type Argument disabledboolean <optional>
classNamestring <optional>
tooltipstring <optional>
-
ValidatorOptions
-
Properties:
Name Type Argument Description dayFormatterfunction(oj.DateRestrictionValidator.DayFormatterInput): (oj.DateRestrictionValidator.DayFormatterOutput | null | 'all') <optional>
Additional info to be used when rendering the day. This should be a JavaScript Function callback which accepts as its argument the following JSON format {fullYear: Date.getFullYear(), month: Date.getMonth()+1, date: Date.getDate()}and returnsnullor all or partial JSON data of the form{disabled: true|false, className: "additionalCSS", tooltip: 'Stuff to display'}messageSummarystring <optional>
an optional custom error message summarizing the error. When not present, the default message summary is the resource defined with the key oj-validator.restriction.date.messageSummary. Tokens: {value} - value entered by user. Example:
"Value {value} is disabled."
messageDetailstring <optional>
a custom error message used for creating detail part of message. When not present, the default message detail is the resource defined with the key oj-validator.restriction.date.messageDetail. Tokens: {value} - value entered by user. Example:
"Value {value} is a disabled entry. Please select a different date."