ForgeComponents
en

Components

j-TimePicker

jComponent 20 · jcomponent@20 component Example loaded with jComponent 20
  • supports dark mode

Configuration:

  • seconds {Boolean} optional, enables seconds (default: false)
  • ampm {Boolean} optional, enables 12 hours time format (default: false)

The component must be called manually or works with j-Input component automatically. This component is a singleton.

  • important add the component under <body> element

Usage

var opt = {};

// opt.offsetX {Number}    : adds X offset (default: 0)
// opt.offsetY {Number}    : adds Y offset (default: 0)
// opt.seconds {Boolean}   : shows seconds (default: false)
// opt.ampm    {Boolean}   : shows 12 hours time format (default: false)
// opt.align   {left|center|right} (default: left)

opt.value = new Date();
// or
// opt.value = 'path.to.date' (in this case you don't need to declare "opt.callback")

opt.element = YOUR_ELEMENT;

opt.callback = function(date) {
	console.log(date);
};

// opt.close {Function} optional, this function can determine the closing of TimePicker

SETTER('timepicker/show', opt);

Use it with <ui-component name="timepicker">. When the component is not loaded yet, jComponent downloads it on first use from the address in DEF.fallback (the Componentator CDN by default). Author: Peter Širka. Source: the Componentator components repository, MIT license.

example.html
<a href="#timepicker">SHOW TIMEPICKER <ui-bind path="form.date" config="html:value.format('HH\:mm\:ss')"></ui-bind></a>
<ui-component name="timepicker"></ui-component>

<script>
	var form = {};
	form.date = new Date();

	$('a[href="#timepicker"]').on('click', function(e) {
		var opt = {};
		opt.element = this;
		opt.value = 'form.date';
		opt.seconds = true;
		SETTER('timepicker/toggle', opt);
	});
</script>