Control type date

default.control

Allows freeform input of dates

Output a date control with the name "foo"

{{control "foo" control-type="date"}}

or just

{{control "foo"}}

if the controltype property for the "foo" property in the model schema has been set to "date"

Error codes

Source:
See:
To Do:
  • Provide better explanation for normalize

  • Provide som example expected input -> output

Methods

(static) initialize()

Sets instantValidation to false

Source:

(static) normalize(value)

Somewhat hardcore regexxing that requires much better explanation

Parameters
Name Type Description
value string

Date string to be normalized

Source:

(static) prepare(control, phrasekey, options)

Sets correct format for date type

  • is it just month/year?
Parameters
Name Type Description
control control

Control object

phrasekey string

Phrase key to provide format

options object
Source:

(static) validate(value, options)

Checks

Parameters
Name Type Description
value string

Date to be validated

options object

Validation options

Source:

(inner) adjustMonth(m) → {string}

Prepends month with 0 if less than 10

Parameters
Name Type Description
m number

Month

Source:
Returns
Type
string

(inner) adjustYear(m) → {number}

Sets years entered as less

eg.

adjustYear(15) -> 2015
adjustYear(1986) -> 1986
Parameters
Name Type Description
m number

Year

Source:
Returns
Type
number

(inner) dateValidateHelper(control, type, value) → {boolean}

Parameters
Name Type Description
control control

Control object

type string

Whether date is before or after

value string

Date value to validate

Error codes

  • date.{{type}}
  • {{control.options[type]}}.error
Source:
Returns
Type
boolean