0.3.1 • Published 10 years ago
gregory v0.3.1
Gregory
React calendar component.
Name
There is no good and vacant names, so: calendar → Gregorian calendar → Gregory.
Examples

var React = require('react');
var Calendar = require('gregory');
function onDatePicked(date) {
console.log(date);
}
React.render(
<Calendar CLASSNAME="cldr"
UI_HAS_SIX_ROWS={false}
ON_SELECT={onDatePicked} />,
document.getElementById('calendar')
);Compatibility
In theory: IE9+ now, IE8+ with polyfills (shims alter environment, so that they aren't included).
In practice: tested on modern browsers only.
Installation
Gregory is available as an npm package:
npm install gregoryOptions
There are three categories of options
Base options
CLASSNAMEsets prefix for all elements classnamesON_SELECTis callback on clicked/selected cell with enabled date
Date options
DATE_CURRENTis default/current date for calendar- All dates above
DATE_MAXare disabled/unselectable - All dates behind
DATE_MINare disabled/unselectable
UI options
UI_DAY_CLASSNAMEsets function for adding classNames to day-cellUI_DAY_RENDERsets middleware function for day-cell renderUI_FORMAT_MONTHsets format of current month at header (See moment.js documentation)UI_HAS_SIX_ROWSsets showing of six rows always even for FebruaryUI_HAS_WEEKDAYSsets visibility of header with weekdays captionsUI_MONTHS_NUMBERsets number of monthsUI_TEXT_NEXTsets caption for next-month buttonUI_TEXT_PREVsets caption for prev-month buttonUI_WEEKDAYSis array of weekdays captions
Contributing
npm install
npm start # build examples and start server
npm test # tests and lintingSee gulpfile for more usefull tasks.
- 4 spaces for indentation
- No classes or prototypes, just functions
- If function should use this.props, pass it as first argument
- Priority: simplicity > consistency > performance
License
MIT