Skip to content

haha54carol/calendar-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

calendar-generator

A simple generator of calendar object. 📆

Installation

npm install calendar-generator

or

yarn add calendar-generator

Import

ES6+, Babel, Webpack, etc.. environments

import { genCalendarObj } from 'calendar-generator'

Example

import { genCalendarObj } from 'calendar-generator'

const fromDate = '2017-12-18' // format: 'YYYY-MM-DD
const toDate = '2017-12-23' 


let cObj = genCalendarObj(fromDate, toDate)

cObj

before date and after date will be included. Because these date are in the same week with input date range.

cObj = {
   "date":{
      "2017-12-17":{
         "inputRange":false,
         "year":2017,
         "month":12,
         "day":17,
         "dayOfWeek":0,
         "week":51
      },
      "2017-12-18":{
         "inputRange":true,
         "year":2017,
         "month":12,
         "day":18,
         "dayOfWeek":1,
         "week":51
      },
      "2017-12-19":{
         "inputRange":true,
         "year":2017,
         "month":12,
         "day":19,
         "dayOfWeek":2,
         "week":51
      },
      "2017-12-20":{
         "inputRange":true,
         "year":2017,
         "month":12,
         "day":20,
         "dayOfWeek":3,
         "week":51
      },
      "2017-12-21":{
         "inputRange":true,
         "year":2017,
         "month":12,
         "day":21,
         "dayOfWeek":4,
         "week":51
      },
      "2017-12-22":{
         "inputRange":true,
         "year":2017,
         "month":12,
         "day":22,
         "dayOfWeek":5,
         "week":51
      },
      "2017-12-23":{
         "inputRange":true,
         "year":2017,
         "month":12,
         "day":23,
         "dayOfWeek":6,
         "week":51
      }
   },
   "monthWeekDate":{
      "12":{
         "51":[
            "2017-12-17",
            "2017-12-18",
            "2017-12-19",
            "2017-12-20",
            "2017-12-21",
            "2017-12-22",
            "2017-12-23"
         ]
      }
   }
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published