calendar-data-structure
v0.3.0
Published
A calendar structure, to create month and weeks arrays that help the view creation
Downloads
3
Maintainers
Readme
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
- Boolean =>
- weekStartDay => (0 - 6) Week day number
- Integer =>
0
- Integer =>
- actualDate => The date to start the calendar
- Date =>
new Date()
- 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
- diff => Integer that represent the days to add or remove from the
- 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
- diff => Integer that represent the weeks to add or remove from the
- 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
- diff => Integer that represent the months to add or remove from the
- 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
- diff => Integer that represent the years to add or remove from the
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