All Projects → year-calendar → js-year-calendar

year-calendar / js-year-calendar

Licence: Apache-2.0 license
A fully customizable year calendar widget

Projects that are alternatives of or similar to js-year-calendar

rc-year-calendar
Official React wrapper for the year-calendar widget
Stars: ✭ 27 (-83.54%)
Mutual labels:  widget, year-calendar
Qt-Timeline-Widget
[Qt控件] 时间轴列表控件
Stars: ✭ 43 (-73.78%)
Mutual labels:  widget
Toolbarindicator
A toolbar indicator for android, likes twitter's.
Stars: ✭ 227 (+38.41%)
Mutual labels:  widget
book-library
📚 A book library app for both Android & IOS ~ Flutter.dev project in Dart
Stars: ✭ 89 (-45.73%)
Mutual labels:  widget
Form Render
🚴‍♀️ 阿里飞猪 - 很易用的中后台「表单 / 表格 / 图表」解决方案
Stars: ✭ 3,881 (+2266.46%)
Mutual labels:  widget
ios-scriptable-tsx
在 vscode 上使用 typescript 和 jsx 开发 ios 小组件的小框架.基于 Scriptable app.
Stars: ✭ 113 (-31.1%)
Mutual labels:  widget
Titan
Create Discord server widgets for websites of all sizes! A simple to setup process for end-users. Server members may view or send messages into an embedded Discord channel.
Stars: ✭ 221 (+34.76%)
Mutual labels:  widget
instagram-widget-by-wpzoom
The easiest way to add a nice Instagram widget on your WordPress site. It just works!
Stars: ✭ 22 (-86.59%)
Mutual labels:  widget
SyntaxPane
A simple to use Swing JEditorKit component supporting syntax highlighting for various languages. Issue tracker: https://codeberg.org/sciss/SyntaxPane/issues
Stars: ✭ 32 (-80.49%)
Mutual labels:  widget
Yii2 Imperavi Widget
Imperavi Redactor widget for Yii 2
Stars: ✭ 250 (+52.44%)
Mutual labels:  widget
Pagerbeauty
📟✨ PagerDuty on-call widget for monitoring dashboard. Datadog and Grafana compatible
Stars: ✭ 250 (+52.44%)
Mutual labels:  widget
Wiredash Sdk
Interactive user feedback tool for Flutter 🎉
Stars: ✭ 232 (+41.46%)
Mutual labels:  widget
adb-toggle
A homescreen widget to toggle USB debugging on/off
Stars: ✭ 20 (-87.8%)
Mutual labels:  widget
Flutter fluid slider
A fluid design slider that works just like the Slider material widget.
Stars: ✭ 232 (+41.46%)
Mutual labels:  widget
orderable stack
A Flutter orderable stack widget
Stars: ✭ 83 (-49.39%)
Mutual labels:  widget
Sy flutter widgets
纯flutter Widget组件库,不依赖Native及其它第三方package。包括省市区选择器,Rate评分,Stepper步进器,照片墙,地址编辑,自带加载更多的ListView和GridView
Stars: ✭ 225 (+37.2%)
Mutual labels:  widget
Finalcut
A text-based widget toolkit
Stars: ✭ 244 (+48.78%)
Mutual labels:  widget
yii2-grid-view-library
Highly enhanced GridView widget and grid components for Yii2
Stars: ✭ 57 (-65.24%)
Mutual labels:  widget
ProgressBar
Beautiful progress bar for android
Stars: ✭ 62 (-62.2%)
Mutual labels:  widget
wui
Collection of GUI widgets for the web
Stars: ✭ 44 (-73.17%)
Mutual labels:  widget

js-year-calendar

A fully customizable year calendar widget

CircleCI CodeCov NPM

This library is also available for:

React.js Vue.js

Requirements

This plugin uses pure javascript. No library is required.

Installation

You can get the widget using the following methods:

  • From the GitHub repository
  • From the Node package manager, using the following command: npm install js-year-calendar
  • From Yarn, using the following command: yarn add js-year-calendar
  • From the CDN, by adding the following script directly in your HTML page:

<script src="https://unpkg.com/js-year-calendar@latest/dist/js-year-calendar.min.js"></script>

AND

<link rel="stylesheet" type="text/css" href="https://unpkg.com/js-year-calendar@latest/dist/js-year-calendar.min.css" />

Initialization

If you're using javascript modules, don't forget to import the library:

import Calendar from 'js-year-calendar';
import 'js-year-calendar/dist/js-year-calendar.css';

Usage

You can create a calendar using the following javascript code :

new Calendar('.calendar')

Or

new Calendar(document.querySelector('.calendar'));

Where .calendar is the selector of a DIV element that should contain your calendar.

You can also use the following HTML if you don't want to use javascript to initialize the calendar

<div data-provide="calendar"></div>

The calendar will be automatically created when the page will finish loading

Using options

You can specify options to customize the calendar:

new Calendar('.calendar', {
    style: 'background',
    minDate: new Date()
})

You can find the exhaustive list of options in the documentation.

Language

If you want to use the calendar in a different language, you should import the locale file corresponding to the language you want to use, and then set the language prop of the calendar:

import Calendar from 'js-year-calendar';
import 'js-year-calendar/locales/js-year-calendar.fr';

OR

<script src="https://unpkg.com/js-year-calendar@latest/dist/js-year-calendar.umd.min.js"></script>
<script src="https://unpkg.com/js-year-calendar@latest/locales/js-year-calendar.fr.js"></script>

Then

new Calendar('.calendar', {
    language: 'fr'
})

The list of available languages is available here

Updating calendar

You can update the calendar after being instantiated:

const calendar = new Calendar('.calendar');

calendar.setStyle('background');
calendar.setMaxDate(new Date());

You can find the exhaustive list of methods in the documentation.

Events

You can bind events to the calendar at initialization

const calendar = new Calendar('.calendar', {
    clickDay: function(e) {
        alert('Click on day ' + e.date.toString());
    }
});

or later

new Calendar('.calendar');
document.querySelector('.calendar').addEventListener('clickDay', function(e) {
    alert('Click on day ' + e.date.toString());
});

You can find the exhaustive list of events in the documentation.

Migrating v1.x to v2.x

If you are using the dataSource option as a function (callback or promise), the first parameter has changed:

new Calendar('#calendar', {
  dataSource: (year) => {
    console.log(year);
  }
}

becomes

new Calendar('#calendar', {
  dataSource: (period) => {
    console.log(period.year);
  }
}

For more details, check this PR

Migrating from bootstrap-year-calendar

This widget is based on the bootstrap-year-calendar widget. If you were using this widget, these are the modifications to apply to successfully migrate your project:

Initialization

The project doesn't use jQuery anymore, so the initialization of the calendar will be using pure Javascript.

The old code:

$('.calendar').calendar({ /* Options */ })

Will be replaced by:

new Calendar('.calendar', { /* Options */ });

Or

new Calendar($('.calendar').get(0), { /* Options */ });
// Use ".get(0)" to get the DOM element from the jQuery element

Get the calendar from the DOM element

Given that the widget doesn't rely on jQuery, it won't be possible to get the calendar instance from the DOM element anymore:

$('.calendar').data('calendar').set...();

You will have to store the instance of the calendar by yourself:

const calendar = new Calendar('.calendar');

...

calendar.set...();

What next

Check the documentation and examples pages to discover all the functionalities.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].