# j-Calendar

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

Framework: jcomponent20
Product: jComponent 20 (jcomponent@20)
Language: en
Content-SHA256: 92c1d1b46586864f93ac3c32e61f0b4464c046ba8e569d2f3f5bc8166fdbc36f
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: components@910ed1a86f6e72b4f031d3ad0dc7844f9fc5cb8e
Review: not-recorded

- supports __dark mode__
- supports __touch gestures (swipe)__ and fixed full size on mobile

__Configuration__:

- `firstday` {Number} (optional) first day in the week
- `today` {String} (optional) label for `Set today` button
- `days` {String} (optional) days e.g. `SU,MO,TU,WE,TH,FR,SA` (default).
- `months` {String} (optional) months e.g. `January,February,...` (default).
- `yearselect` {Boolean} (optional) dropdown with years (default `true`).
- `monthselect` {Boolean} (optional) dropdown with months (default `true`).
- `yearfrom` {String} (optional) set minimum year limit in dropdown e.g. `-5 years` `current`  (default `-100 years`).
- `yearto` {String} (optional) set maximum year limit in dropdown  `+5 years` `current` (default `current`).

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

- works __only__ with Bootstrap Grid System (otherwise is need to fix CSS)
- __important__ add the calendar component under `<body>` element

## Usage

```javascript
var ELEMENT = $(document);
var PATH = 'some.path.to.date';
var X_OFFSET = 100;
FIND('calendar').toggle(ELEMENT, PATH, function(date) {
	console.log('SELECTED DATE:', date);
}, X_OFFSET);

// OR

FIND('calendar').toggle(ELEMENT, 'path.to.date OR date object', 'path.to.binding.date');
```

Use it with `<ui-component name="calendar">`. 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.

```html example.html
<a href="#calendar">SHOW CALENDAR</a>
<ui-component name="calendar" config="today:Set today;firstday:0"></ui-component>

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

	$('a[href="#calendar"]').on('click', function(e) {
		SETTER('calendar', 'toggle', $(this), form.date, function(date) {
			alert(date);
		});
	});
</script>
```
