An open API service indexing awesome lists of open source software.

https://github.com/konsumer/mithril-calendar

A calendar component for mithril
https://github.com/konsumer/mithril-calendar

Last synced: over 1 year ago
JSON representation

A calendar component for mithril

Awesome Lists containing this project

README

          

# mithril-calendar

A calendar component for mithril.

[![NPM](https://nodei.co/npm/mithril-calendar.png?compact=true)](https://nodei.co/npm/mithril-calendar/)

You can see a demo [here](http://konsumer.github.io/mithril-calendar).

## installation

You can get a copy with bower or npm or just download it from the `dist/` folder, here.

### webpack/browserify/etc

```js
var MithrilCalendar = require('mithril-calendar');
```

### requirejs

```js
define(['mithril','MithrilCalendar'], function(m,MithrilCalendar){

});
```

### plain browser globals
```html

```

## usage

Have a look at `index.js` to see how to construct the view, if you don't want it to look like mine, or want to leave out links or whatever, just construct your own view from stuff exposed in the controller.

```js
var MyComponent = {
controller: function(){
var now = new Date();
this.year = m.route.param('year') ? m.route.param('year') : now.getFullYear();
this.month = m.route.param('month') ? m.route.param('month') : now.getMonth()+1;
this.calendar = new MithrilCalendar.controller(this.year, this.month);
},
view: function(ctrl){
return MithrilCalendar.view(ctrl.calendar);
}
}
```

You will also need some CSS. I use LESS, so you can use that from `dist/MithrilCalendar.less` or the CSS file I built from it.

You can also get it via CDN, like this:

```html

```