j-Calendar
- supports dark mode
- supports touch gestures (swipe) and fixed full size on mobile
Configuration:
firstday{Number} (optional) first day in the weektoday{String} (optional) label forSet todaybuttondays{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 (defaulttrue).monthselect{Boolean} (optional) dropdown with months (defaulttrue).yearfrom{String} (optional) set minimum year limit in dropdown e.g.-5 yearscurrent(default-100 years).yearto{String} (optional) set maximum year limit in dropdown+5 yearscurrent(defaultcurrent).
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
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.
<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>