/hyperdom-calendar

Calendar component for hyperdom

Primary LanguageJavaScript

Hyperdom Calendar

A simple calender for Hyperdom

DEMO

alt text

Install

npm

npm i hyperdom-calendar -S

Usage

Make sure you add calendar.min.css to your styles.

var h = require('hyperdom').html
var calendar = require('hyperdom-calendar')

function render(model) {
  model.contactCalendar = {}
  return calendar(contactCalendar)
}

API

a Hyperdom model object is required for this component to work. The component will bind these properties to model.chosenObject

// returns todays date as date object
model.chosenObject.today
// returns selected date as date object , initially set to todays date
model.chosenObject.selected.date
// returns selected month as a digit
model.chosenObject.selected.month()
// returns next month from selected month as a digit
model.chosenObject.selected.nextMonth()
// returns prev month from selected month as a digit
model.chosenObject.selected.prevMonth()
// set day for current month current month, returns date object for that day
model.chosenObject.selected.setDay(day)
// returns month as a string
model.chosenObject.selected.monthString()
// returns day for selected date
model.chosenObject.selected.day()
// returns year for selected date
model.chosenObject.selected.year()