Class: DateTimeRangeValidator

Oracle® JavaScript Extension Toolkit (JET)
3.2.0

E87541-01

QuickNav

oj. DateTimeRangeValidator

Version:
  • 3.2.0
Since:
  • 0.6

Constructor

new DateTimeRangeValidator(options)

Constructs a DateTimeRangeValidator that ensures the value provided is within a given range
Parameters:
Name Type Argument Description
options Object <optional>
an object literal used to provide the following properties
Properties
Name Type Argument Description
converter Object 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.
min string <optional>
the minimum datetime value of the entered value. Should be ISOString.
max string <optional>
the maximum datetime value of the entered value. Should be ISOString.
hint Object <optional>
an optional object literal of hints to be used.
Properties
Name Type Argument Description
max string <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 maximum

Usage:
Enter a datetime less than or equal to {max}

min string <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 minimum

Usage:
Enter a datetime greater than or equal to {min}

inRange string <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 maximum

Usage:
Enter a datetime between {min} and {max}

translationKey string <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)
  • "datetime"
  • "date"
  • "time"

messageDetail Object <optional>
an optional object literal of custom error messages to be used.
Properties
Name Type Argument Description
rangeUnderflow string <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 value

Usage:
Entered {value} with min being {min}

rangeOverflow string <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 value

Usage:
Entered {value} with max being {max}

messageSummary Object <optional>
optional object literal of custom error summary message to be used.
Properties
Name Type Argument Description
rangeUnderflow string <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.
rangeOverflow string <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.
Source:

Methods

getHint() → {string|null}

A message to be used as hint.
Source:
Returns:
a hint message or null if no hint is available in the options
Type
string | null

Init(options)

Initializes validator instance with the set options
Parameters:
Name Type Argument Description
options Object <optional>
Source:

validate(value) → {string}

Validates the minimum + maximum conditions
Parameters:
Name Type Description
value string that is being validated
Source:
Throws:
when there is no match
Type
Error
Returns:
original if validation was successful
Type
string