0.0.5 • Published 9 years ago

calendr v0.0.5

Weekly downloads
6
License
MIT
Repository
github
Last release
9 years ago

Calendr.js

Build Status Code Climate David DM

Weeks array grid for calendar month

Installation

npm install calendr

Example

var Calendr = require('calendr');

var april = new Date(2014, 3); // month is 0 indexed
var aprilcal = new Calendr(april);

aprilcal.grid

Returns:

[
  [30,  31,  1,   2,   3,   4,   5],
  [6,   7,   8,   9,   10,  11,  12],
  [13,  14,  15,  16,  17,  18,  19],
  [20,  21,  22,  23,  24,  25,  26],
  [27,  28,  29,  30,  1,   2,   3]
]

When dayObjects is true each day item is returned as a Day object instead of a Number.

var april = new Date(2014, 3);
var aprilcal = new Calendr(april);
aprilcal.dayObjects = true;

or

var aprilcal = new Calendr(april, {dayObjects: true});

Day objects include these methods:

day.date()       // the date eg. 12
day.month()      // the month eg. 2 (this is 1 index)
day.year()       // the full year eg. 2014
day.isToday()    // returns Boolean based on whether this `Day` is today
day.name()       // the name of the day of the week, eg. Monday, Tuesday, etc...
day.monthName()  // the name of the day of the month, eg. January, February, etc...

day.moment       // returns the day's date as a Moment.js object

License

MIT

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago