1.0.0 • Published 8 years ago

ui-timeinterval v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

ui-timeinterval

Web UI widget for selecting time interval

js-semistandard-style

Installation

$ npm install ui-timeinterval --save-dev

Usage

const Timeinterval = require('ui-timeinterval');
const options = {
  // Set up options here (see below)
};

const someTimeinterval = new Timeinterval(options);
someContainerElement.appendChild(someTimeinterval.element);
someTimeinterval.getValue();

Options

Type: {Object}

tabindex

Type: {Integer}

The value of tabindex attribute to be set for the DOM element of the first button. Default: 1.

initialValue

Type: {Object}

Sets up the initial value of the element.

Properties:

  • {Date} from - Interval start date;
  • {Date} to - Interval end date.

Defaults:

  • to 23:59:59.999 of today;
  • from 00:00:00.000 of yesterday.

onValueChange

Type: {Function | Array<Function>}

Callback function(s) that will be called every time the value of the element changes.

When called, the function will be passed the following arguments:

  • {Object} val - New value of the element. Properties:
    • {Date} from - Interval start date;
    • {Date} to - Interval end date.

API

Properties

element

Type: {HTMLElement}

Returns reference to the DOM node created by the constructor.

lastTabindex

Type: {Integer}

Returns the last tabindex value used by the component.

Methods

getValue()

Gets the current value of the component.

Return: {Object} val - New value of the element. Properties:

  • {Date} from - Interval start date;
  • {Date} to - Interval end date.Â

setValue(val)

Sets the element's value.

Parameters:

  • {Object} val - New value of the element. Properties:
    • {Date} from - Interval start date;
    • {Date} to - Interval end date.

Return: {undefined}