Class: DateField

DateField()

The DateField is an extension of the EditorField by accepting Date Objects for values and using the Calendar view for user input.

Constructor

new DateField()

Source:
Requires:
  • module:argos.Calendar
  • module:argos.FieldManager
  • module:argos.Format
Example
{
        name: 'StartDate',
        property: 'StartDate',
        label: this.startDateText,
        type: 'date',
        dateFormatText: 'MM/DD HH:mm:ss',
        showTimerPicker: true,
        showRelativeDateTime: true
    }

Extends

Requires

  • module:argos.Calendar
  • module:argos.FieldManager
  • module:argos.Format

Members

attributeMap

Properties:
Name Type Description
Creates Object a setter map to html nodes, namely: * inputValue => inputNode's value attribute
Inherited From:
Source:

currentValue

Properties:
Name Type Description
Value Object/String/Date/Number storage for current value, as it must be formatted for display this is the full value.
Inherited From:
Source:

emptyText

Source:

invalidDateFormatErrorText

Properties:
Name Type Description
The String error validation message for this field. `${0}` => Label
Source:

originalValue

Properties:
Name Type Description
Value String storage for keeping track of modified/unmodified values. Used in isDirty.
Inherited From:
Source:

required :Boolean

required should be true if the field requires input. Defaults to false.
Type:
  • Boolean
Overrides:
Source:

showRelativeDateTime

Source:

showTimePicker

Source:

timeless

Source:

validationValue

Properties:
Name Type Description
Value Object/String/Date/Number storage for the value to use in validation, when gathering values from the editor view the validationValue is set using `getValues(true)` which returns all values even non-modified ones.
Inherited From:
Source:

view

Properties:
Name Type Description
The String target view id that will provide the user input, this should always be to set to the Calendars view id.
Overrides:
Source:

widgetTemplate

Properties:
Name Type Description
Simplate Simplate that defines the fields HTML Markup * `$` => Field instance * `$$` => Owner View instance
Overrides:
Source:

Methods

_disableTextElement()

Sets the input nodes' disabled attribute to true
Inherited From:
Source:

_enableTextElement()

Sets the input nodes' disabled attribute to false
Inherited From:
Source:

_onChange(evt)

When a value changes it checks that the text in the input field matches the defined `dateFormatText` by using it to parse it back into a Date Object. If this succeeds then sets the current value to the Date object and removes any validation warnings. If it doesn't then current value is empties and the validation styling is added.
Parameters:
Name Type Description
evt Event Event that caused change to fire.
Source:

_onClick(evt)

Handler for the `onclick` event of the fields container. Invokes navigateToEditView.
Parameters:
Name Type Description
evt Event
Overrides:
Source:

_onComplete()

Handler for `_onComplete` which is fired after the user has completed the form in the editor view Fires onChange.
Inherited From:
Source:

clearValue()

Extends the parent clearValue to also include removing the error validation styling.
Overrides:
Source:

complete()

Handler for the toolbar item that is passed to the editor view. When this function fires the view shown is the editor view but the function is fired in scope of the field. It gets a handler of the current active view and validates the form, if it passes it gathers the value, sets the fields text, calls `ReUI.back` and fires _onComplete.
Inherited From:
Source:

createNavigationOptions() → {Object}

Extends the parent createNavigationOptions to also include the properties `date`, `showTimePicker` and `timeless` with `date` being the current value
Overrides:
Source:
Returns:
Navigation options
Type
Object

disable()

Extends the parent implementation to also call _disableTextElement.
Inherited From:
Source:

enable()

Extends the parent implementation to also call _enableTextElement.
Inherited From:
Source:

formatValue(value) → {String}

Takes a date object and calls format.date passing the current `dateFormatText` and `timeless` values, formatting the date into a string representation.
Parameters:
Name Type Description
value Date Date to be converted
Overrides:
Source:
Returns:
Type
String

getValue() → {Object/String/Date/Number}

Returns the current value
Inherited From:
Source:
Returns:
Type
Object/String/Date/Number

getValuesFromView()

Retrieves the date from the Calendar view and sets it to currentValue.
Overrides:
Source:

init()

Extends the parent implementation to connect the `onclick` event of the fields container to _onClick.
Inherited From:
Source:

isDirty() → {Boolean}

Determines if the current value has been modified from the original value.
Overrides:
Source:
Returns:
Type
Boolean
Navigates to the given `this.view` using the options from createNavigationOptions.
Inherited From:
Source:

setText(text)

Sets the displayed text to the input.
Parameters:
Name Type Description
text String
Inherited From:
Source:

setValue(val, initial)

Sets the current value to the item passed, as the default if initial is true. Then it sets the displayed text using setText with the formatted value. If null/false is passed all is cleared and `this.emptyText` is set as the displayed text.
Parameters:
Name Type Description
val Object/String/Date/Number Value to be set
initial Boolean True if the value is the default/clean value, false if it is a meant as a dirty value
Inherited From:
Source:

validate() → {Boolean/Object}

Extends the parent validate with a check that makes sure if the user has inputted a date manually into the input field that it had successfully validated in the _onChange function.
Overrides:
Source:
Returns:
False for no errors. True/Object for invalid.
Type
Boolean/Object