A simple calender for Hyperdom
npm i hyperdom-calendar -S
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)
}
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()