APIs

Show:

Wrapper for input[type='date/datetime/datetime-local'] component. Please keep in mind that these input types are not supported in all browsers, see supported browsers.

Methods

_convertDateToLocal

(
  • value
)
Date private

Converts date (without time) to local date.

Parameters:

  • value String | Date

    Date without timezone shift.

Returns:

Date:

Object of Date.

_convertDateToString

(
  • value
)
String private

Convert Date object to appropriate string value for input.

Parameters:

  • value Date

    Object of Date.

Returns:

String:

Date in string format.

_convertStringToDate

(
  • value
)
Date private

Converts string value of input to Date object.

Parameters:

  • value String

    Date in string format.

Returns:

Date:

Object of Date.

_flatpickrCreate

() private

Create Flatpickr instance, and save it into _flatpickr property.

_flatpickrDestroy

() private

Destroy Flatpickr instance.

_validationDateTime

() private

Validation date and time.

actions.open

()

Open flatpickr.

actions.remove

()

Clear current value.

click

() private

Component click handler.

getTargetObjectByCondition.

(
  • condition
)
Null | Component | Controller

Returns that 'targetObject' (from 'targetObject's hierarchy) which satisfies a given condition.

let controller = this.getTargetObjectByCondition((targetObject) => {
                      return targetObject instanceof Controller;
                    });
                    

Parameters:

  • condition Function

    Callback-function, which will be called for each 'targetObject' in 'targetObject's hierarchy, until callback return true for one of them.

Returns:

Null | Component | Controller:

Target object which satisfies a given condition or null.

initProperty

(
  • options
)

Initializes component's property with recpect to following priority: 1 - template-defined parameters, 2 - applicaion configuration-defined parameters (JSON from ./config/environment by path defined in 'appConfigSettingsPath' property), 3 - component-defined defaults. Note! It is important to be declared as undefined for those component properties, which will be initialized through 'initProperty' call.

// ./config/environment.js.
                    module.exports = function(environment) {
                      var ENV = {
                        APP: {
                          components: {
                            myComponent: {
                              myComponentProperty: 'myComponentProperty config-defined default value',
                            }
                          }
                        }
                      };
                      return ENV;
                    };
                    
// /components/my-component.js
                    import FlexberryBaseComponent from 'ember-flexberry/flexberry-base-component';
                    
                    export default FlexberryBaseComponent.extend({
                      appConfigSettingsPath: 'APP.components.myComponent',
                    
                      myComponentProperty: undefined,
                    
                      init() {
                        this._super.apply(this, arguments);
                        this.initProperty({ propertyName: 'myComponentProperty', defaultValue: 'myComponentProperty default value' });
                      }
                    });
                    

Parameters:

  • options Object

    Method options.

    • propertyName String

      Component's property name.

    • defaultValue

      Component's property default value (from component defined default's).

reinitFlatpickrObserver

()

Observer for reinit flatpickr (defaultHour, defaultMinute, and others, for dynamically updating because set() for this options doesn't update view).

willDestroyElement

()

Called when the element of the view is going to be destroyed. Override this function to do any teardown that requires an element, like removing event listeners. More info.

Properties

_maxAsString

String private

Convert date in max to appropriate input datatype. For example, see here.

Default: null

_minAsString

String private

Convert date in min to appropriate input datatype. For example, see here.

Default: null

_valueAsDate

Date private

Store current value as Date object.

Default: null

_valueAsString

String private

Convert date in value to appropriate input datatype. For example, see here.

Default: null

altDateFormat

String

Exactly the same as date format, but for the altInput field.

altDateTimeFormat

String

Exactly the same as date format, but for the altInput field.

appConfig

Object

Application configuration (JSON from ./config/environment.js).

Default: null

appConfigSettings

Object

Component settings object from application configuration (part of JSON from ./config/environment.js). Part of appConfig related to appConfigSettingsPath.

Default: null

appConfigSettingsPath

String

Path to component's settings in application configuration (JSON from ./config/environment.js).

Default: 'APP.components.flexberrySimpledatetime'

calendarContext

String

The selector to get the element (using jQuery) for the appendTo flatpickr option.

canClick

Bool

If true, then onClick calling flatpickr.open().

classNames

Array

Array CSS class names. More info.

componentName

String

Unique name of the component. TODO: use guidFor from 'ember-metal/utils'

currentController

Controller

Current controller.

Default: null

currentTypeSupported

Boolean

Checks whether the browser supports the date field.

dateFormat

String

A string of characters which are used to define how the date will be displayed in the input box. The supported characters are defined in the table below.

dateTimeFormat

String

A string of characters which are used to define how the date will be displayed in the input box. The supported characters are defined in the table below.

dateTimeMask

String

DateTime mask.

defaultHour

Integer

Default value of hour.

Default: 12

defaultMinute

Integer

Default value of minute.

Default: 0

dynamicProperties

Object

Component dynamic properties ({ componentPropertyName: value }). Used when component renders dynamically with ember {{component}} helper: {{component 'my-component' value=value dynamicProperties=myConponentProperties}}. In the end of component initialization its properties values will be replaced with values from this object.

Default: null

eventNamespace

String

Namespase for page event.

locale

String

If undefined, then uses application locale. Supported locales: 'en', 'ru'.

max

Date

Maximum value of date.

min

Date

Minimum value of date.

openButton

Bool

If true, then flatpickr has open button.

placeholder

String

Text to be displayed in field, if field has not been filled.

Default: 't('components.flexberry-simpledatetime.placeholder')'

readonly

Boolean

Flag: indicates whether component is readonly.

Default: false

readonlyAttr

String | Undefined

Readonly HTML attribute following to the readonly query param. According to the W3C standard, returns 'readonly' if readonly is true and undefined otherwise.

relatedModel

DS.Model

Model to which current component's value is related.

Default: null

removeButton

Bool

If true, then flatpickr has remove button.

required

Boolean

Flag: indicates whether component is required.

Default: false

scrollClassNames

Array

Array CSS class names for scroll.

type

String

Type of date picker.

Default: null

useOnlyFlatpickr

Boolean

Flag indicates only flatpickr using for this component.

Default: true

validDateFormat

String

Date format for validate.

validDateTimeFormat

String

DateTime format for validate.

value

Date

Value of date.