Usage
Signature:
final class DateTimeRangeValidator implements Validator<string>
Typescript Import Format
//This class is exported directly as module. To import it
import DateTimeRangeValidator= require("ojs/ojvalidator-datetimerange");
For additional information visit:
Final classes in JET
Classes in JET are generally final and do not support subclassing. At the moment, final is not enforced. However, this will likely change in an upcoming JET release.
- See:
-
- oj.AsyncDateTimeRangeValidator
Constructor
new DateTimeRangeValidator(options)
Parameters:
| Name | Type | Argument | Description |
|---|---|---|---|
options |
oj.DateTimeRangeValidator.ValidatorOptions |
<optional> |
an object literal used to provide the following properties |
- See:
-
- oj.AsyncDateTimeRangeValidator
Methods
-
getHint : {string|null}
-
A message to be used as hint.
Returns:
a hint message or null if no hint is available in the options
- Type
- string | null
-
validate(value) : {void}
-
Validates the minimum + maximum conditions
Parameters:
Name Type Description valuestring that is being validated Throws:
when there is no match- Type
- Error
Returns:
- Type
- void
Type Definitions
-
ValidatorOptions
-
- "datetime"
- "date"
- "time"
Properties:
Name Type Argument Description converteroj.DateTimeConverter an instance implementation of oj.DateTimeConverter (i.e. oj.IntlDateTimeConverter). In order to compare isoString value with the timeZone options in the converter, it is necessary for the validator that a converter is passed in. hintObject <optional>
an optional object literal of hints to be used. If not set, defaults will be used for the validator hint. See the individual hint properties below for details. Properties
Name Type Argument Description inRangestring <optional>
a hint used to indicate the allowed range. When not present, the default hint is the resource defined with the key oj-validator.range.datetime.hint.inRange.Tokens:
{min} the minimum
{max} the maximumUsage:
Enter a datetime between {min} and {max}maxstring <optional>
a hint used to indicate the allowed maximum. When not present, the default hint is the resource defined with the key oj-validator.range.datetime.hint.max.Tokens:
{max} - the maximumUsage:
Enter a datetime less than or equal to {max}minstring <optional>
a hint used to indicate the allowed minimum. When not present, the default hint is the resource defined with the key oj-validator.range.datetime.hint.min.Tokens:
{min} the minimumUsage:
Enter a datetime greater than or equal to {min}maxstring <optional>
the maximum datetime value of the entered value. Should be ISOString. messageDetailObject <optional>
an optional object literal of custom error messages to be used. Properties
Name Type Argument Description rangeOverflowstring <optional>
the detail error message to be used when input value exceeds the maximum value set. When not present, the default detail message is the resource defined with the key oj-validator.range.datetime.messagedetail.rangeOverflow.Tokens:
{value} - value entered by the user
{max} - the maximum allowed valueUsage:
Entered {value} with max being {max}rangeUnderflowstring <optional>
the detail error message to be used when input value is less than the set minimum value. When not present, the default detail message is the resource defined with the key oj-validator.range.datetime.messagedetail.rangeUnderflow.Tokens:
{value} - value entered by the user
{min} - the minimum allowed valueUsage:
Entered {value} with min being {min}messageSummaryObject <optional>
optional object literal of custom error summary message to be used. Properties
Name Type Argument Description rangeOverflowstring <optional>
the summary of the error message when input value exceeds the maximum value set. When not present, the default message summary is the resource defined with the key oj-validator.range.datetime.messageSummary.rangeOverflow.rangeUnderflowstring <optional>
the summary of the error message when input value is less than the set minimum value. When not present, the default message summary is the resource defined with the key oj-validator.range.datetime.messageSummary.rangeUnderflow.minstring <optional>
the minimum datetime value of the entered value. Should be ISOString. translationKeystring <optional>
an optional string for the default messages + hints. Note that this is required only when the validator is used standlone (i.e. if one uses min + max attribute for ojInputDate the validator will have this already be set to correct "date" value)