Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

calendar-month-array

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

calendar-month-array - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

6

index.js

@@ -13,8 +13,8 @@ module.exports = function (monthDate, opts) {

var first = new Date(monthDate.getYear(), monthDate.getMonth(), 1)
var last = new Date(monthDate.getYear(), monthDate.getMonth() + 1, 0)
var first = new Date(monthDate.getFullYear(), monthDate.getMonth(), 1)
var last = new Date(monthDate.getFullYear(), monthDate.getMonth() + 1, 0)
var monthFirstDayPosition = (7 + first.getDay() - weekStartDay) % 7
var calendarLastDay = last.getDate() + monthFirstDayPosition
var weeks = Math.ceil((calendarLastDay + monthFirstDayPosition) / 7)
var weeks = Math.ceil(calendarLastDay / 7)
var lines = new Array(weeks)

@@ -21,0 +21,0 @@ var headers = new Array(7)

{
"name": "calendar-month-array",
"version": "2.1.0",
"version": "2.1.1",
"description": "Generates a calendar array with the days of a single month organized by week",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -7,2 +7,12 @@ var calendar = require('../')

test('proper first day and last day are found', function (t) {
var date = new Date('2019-01-01 00:00:00')
var expectedFirstDay = new Date('2018-12-30 00:00:00')
var expectedLastDay = new Date('2019-02-02 00:00:00')
var cal = calendar(date)
t.deepEqual(cal[0][0], expectedFirstDay, 'first cell is 30th of dec')
t.deepEqual(cal[cal.length-1][6], expectedLastDay, 'last day is 2nd of feb')
t.end()
})
test('calendar starts on Sunday (default)', function (t) {

@@ -9,0 +19,0 @@ var expectedDay = new Date('1995-01-01 00:00:00') // it's a Sunday

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc