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
- Host: GitHub
- URL: https://github.com/konsumer/mithril-calendar
- Owner: konsumer
- Created: 2015-02-08T13:47:57.000Z (over 11 years ago)
- Default Branch: gh-pages
- Last Pushed: 2016-06-17T19:21:53.000Z (about 10 years ago)
- Last Synced: 2025-02-28T14:49:50.571Z (over 1 year ago)
- Language: JavaScript
- Size: 12.7 KB
- Stars: 8
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# mithril-calendar
A calendar component for mithril.
[](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
```