Comparing version 0.2.0 to 0.2.1
@@ -5,3 +5,3 @@ var moment = require('moment'); | ||
function Calendar(year, month) { | ||
function Calendar(year, month, day) { | ||
this.moment = moment(); | ||
@@ -14,3 +14,3 @@ | ||
if (month) { | ||
if ("number" === typeof month) { | ||
if ('number' === typeof month) { | ||
month--; // to offset moment cause moment "0" = Jan. | ||
@@ -23,2 +23,3 @@ } | ||
this.moment.date(1); | ||
this.day = day || 0; | ||
} | ||
@@ -62,3 +63,3 @@ | ||
// finish and close off the week | ||
if (m.day() === 0 && w.length) { | ||
if (m.day() === this.day && w.length) { | ||
weeks.push(w); | ||
@@ -104,3 +105,3 @@ w = []; | ||
if (weeks.length === 5 && opts.withStaticLength) { | ||
w = [] | ||
w = []; | ||
while (w.length < 7) { | ||
@@ -107,0 +108,0 @@ w.push(this.createDay(m)); |
{ | ||
"name": "calendarjs", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Javascript component to creating calendars.", | ||
@@ -21,7 +21,7 @@ "main": "index.js", | ||
"assert": "^1.1.1", | ||
"mocha": "^5.0.0" | ||
"mocha": "^8.1.3" | ||
}, | ||
"dependencies": { | ||
"moment": "^2.17.1" | ||
"moment": "^2.29.0" | ||
} | ||
} |
## 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 | ||
@@ -6,0 +4,0 @@ that is properly displayable. |
8025
6
132
64
Updatedmoment@^2.29.0