calendar-data-structure

0.3.0 • Public • Published

CalendarDataStructure

Simple calendar data structure, will allow you to
  • Get the month data => a weeks array, each one with the data to create every day
  • Get the week data => simplified version of month data, just one week in the array
  • Move to the next or past month / week and get that data

Install

Direct
  • Download
  • Refer in HTML <script type="text/javascript" src="Path/To/File/calendar-data-structure.js"></script>
Browserify
  • Install: npm install --save calendar-data-structure
  • Module: require('calendar-data-structure')

Easy Use

  • Import var myCalendar = require('calendar-data-structure')
  • Instantiate var calendarInstance = new myCalendar(options)
  • Use calendarInstance.getWeeksArr()

Info

Options

Possible attributes

  • sixWeeksPerMonth => if true, force the weeks array to 6 elements
    • Boolean => false
  • weekStartDay => (0 - 6) Week day number
    • Integer => 0
  • actualDate => The date to start the calendar
    • Date => new Date()

Methods

  • getWeeksArr() => Return an array with the weeks for the actualDate month
  • getDaysArr([date]) => Return an array with days for the actualDate week
    • date => Date to use in week
  • setOtherDay(diff) => Change the date, by using an integer (Positive or Negative) that set the differential in days
    • diff => Integer that represent the days to add or remove from the actualDate
  • setOtherWeek(diff) => Change the date, by using an integer (Positive or Negative) that set the differential in weeks
    • diff => Integer that represent the weeks to add or remove from the actualDate
  • setOtherMonth(diff) => Change the date, by using an integer (Positive or Negative) that set the differential in months
    • diff => Integer that represent the months to add or remove from the actualDate
  • setOtherYear(diff) => Change the date, by using an integer (Positive or Negative) that set the differential in years
    • diff => Integer that represent the years to add or remove from the actualDate
IMPORTANT

this is the structure needed to create and navigate in the calendar, this will not decorate. Just return the array with the info, and allow you to surf future and past in calendar.

There is a big TODO list, but in resume
  • Write a better documentation
  • i18n Apply

Package Sidebar

Install

npm i calendar-data-structure

Weekly Downloads

0

Version

0.3.0

License

MIT

Last publish

Collaborators

  • jjdltc