Final Class: DateRestrictionValidator

Oracle® JavaScript Extension Toolkit (JET)
8.3.0

F24340-01

Signature:

final class DateRestrictionValidator implements Validator<string>

QuickNav


DateRestrictionValidator

Version:
  • 8.3.0
Since:
  • 0.6.0
Module:
  • ojvalidator-daterestriction

Module usage

See JET Module Loading for an overview of module usage within JET.

Javascript Import Format
define(['ojs/ojvalidator-daterestriction'], function(DateRestrictionValidator) {
 // Application should call API on DateRestrictionValidator 
})
Typescript Import Format
//This class is exported directly as module. To import it
import DateRestrictionValidator= require("ojs/ojvalidator-daterestriction");

JET In Typescript

A detailed description of working with JET elements and classes in your typescript project can be found at: JET Typescript Usage.

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.AsyncDateRestrictionValidator

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
See:
  • oj.AsyncDateRestrictionValidator

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) : {void}

Validates whether the date provided is part of disabled date
Parameters:
Name Type Description
value string that is being validated
Throws:
when there is no match
Type
Error
Returns:
Type
void

Type Definitions

DayFormatterInput

Input type for the dayFormatter option call back function
Properties:
Name Type
fullYear number
month number
date number

DayFormatterOutput

Output type for the dayFormatter option call back function
Properties:
Name Type Argument
disabled boolean <optional>
className string <optional>
tooltip string <optional>

ValidatorOptions

Properties:
Name Type Argument Description
converter oj.DateTimeConverter <optional>
an instance implementation of oj.DateTimeConverter (i.e. oj.IntlDateTimeConverter). It is used to change the format of the value shown in a validation error message if the {value} token is used in messageSummary or messageDetail. Defaults to a new instance of IntlDateTimeConverter.
dayFormatter function(DateRestrictionValidator.DayFormatterInput): (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 returns null or all or partial JSON data of the form {disabled: true|false, className: "additionalCSS", tooltip: 'Stuff to display'}
messageSummary string <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."

messageDetail string <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."