🚀 Big News:Socket Has Acquired Secure Annex.Learn More
Socket
Book a DemoSign in
Socket

calendarjs

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

calendarjs - npm Package Compare versions

Comparing version
0.0.1
to
0.1.0
+1
.travis.yml
language: node_js
## calendarjs
[![Build Status](https://travis-ci.org/sjlu/calendarjs.svg?branch=master)](https://travis-ci.org/sjlu/calendarjs)
A simple javascript component to help you create weeks in a month
that is properly displayable.
You will get something like this:
[ [ { month: 6, date: 1, day: 0, year: 2014 },
{ month: 6, date: 2, day: 1, year: 2014 },
{ month: 6, date: 3, day: 2, year: 2014 },
{ month: 6, date: 4, day: 3, year: 2014 },
{ month: 6, date: 5, day: 4, year: 2014 },
{ month: 6, date: 6, day: 5, year: 2014 },
{ month: 6, date: 7, day: 6, year: 2014 } ],
[ { month: 6, date: 8, day: 0, year: 2014 },
{ month: 6, date: 9, day: 1, year: 2014 },
{ month: 6, date: 10, day: 2, year: 2014 },
{ month: 6, date: 11, day: 3, year: 2014 },
{ month: 6, date: 12, day: 4, year: 2014 },
{ month: 6, date: 13, day: 5, year: 2014 },
{ month: 6, date: 14, day: 6, year: 2014 } ],
[ { month: 6, date: 15, day: 0, year: 2014 },
{ month: 6, date: 16, day: 1, year: 2014 },
{ month: 6, date: 17, day: 2, year: 2014 },
{ month: 6, date: 18, day: 3, year: 2014 },
{ month: 6, date: 19, day: 4, year: 2014 },
{ month: 6, date: 20, day: 5, year: 2014 },
{ month: 6, date: 21, day: 6, year: 2014 } ],
[ { month: 6, date: 22, day: 0, year: 2014 },
{ month: 6, date: 23, day: 1, year: 2014 },
{ month: 6, date: 24, day: 2, year: 2014 },
{ month: 6, date: 25, day: 3, year: 2014 },
{ month: 6, date: 26, day: 4, year: 2014 },
{ month: 6, date: 27, day: 5, year: 2014 },
{ month: 6, date: 28, day: 6, year: 2014 } ],
[ { month: 6, date: 29, day: 0, year: 2014 },
{ month: 6, date: 30, day: 1, year: 2014 },
{ month: 7, date: 1, day: 2, year: 2014 },
{ month: 7, date: 2, day: 3, year: 2014 },
{ month: 7, date: 3, day: 4, year: 2014 },
{ month: 7, date: 4, day: 5, year: 2014 },
{ month: 7, date: 5, day: 6, year: 2014 } ] ]
### Install
* First install the package
npm install calendarjs --save
### Example
var Calendar = require('calendarjs');
// year and month are optional in this
// next part, by default they will choose
// the current year month.
var calendar = new Calendar(2014, 6);
var cal = calendar.generate();
### License
MIT.
+9
-9
var moment = require('moment');
var _ = require('lodash');

@@ -41,5 +40,6 @@ var Calendar = (function() {

// defaults
opts = _.defaults(opts || {}, {
withOtherMonthDays: true
});
opts = opts || {};
if (opts.withOtherMonthDays === undefined) {
opts.withOtherMonthDays = true;
}

@@ -64,3 +64,3 @@ // we will fill in this array

// advance one day
m.add('days', 1);
m.add(1, 'days');
d++;

@@ -78,6 +78,6 @@ }

w = weeks[0];
m = moment(this.moment).subtract('days', 1);
m = moment(this.moment).subtract(1, 'days');
while (w.length < 7) {
w.unshift(this.createDay(m));
m.subtract('days', 1);
m.subtract(1, 'days');
}

@@ -87,6 +87,6 @@ weeks[0] = w;

w = weeks[weeks.length-1];
m = moment(this.moment).add('months', 1);
m = moment(this.moment).add(1, 'months');
while (w.length < 7) {
w.push(this.createDay(m));
m.add('day', 1);
m.add(1, 'day');
}

@@ -93,0 +93,0 @@ weeks[weeks.length-1] = w;

{
"name": "calendarjs",
"version": "0.0.1",
"version": "0.1.0",
"description": "Javascript component to creating calendars.",

@@ -24,5 +24,4 @@ "main": "index.js",

"dependencies": {
"lodash": "^2.4.1",
"moment": "^2.7.0"
"moment": "^2.17.1"
}
}