Giter Club home page Giter Club logo

react-event-calendar's Introduction

npm version

Project Status

This project has been deprecated.

I am afraid I don't have the time to maintain it the to the level I require. Several projects have since surpassed this functionality and anyone looking for event calendars should investigate them to see if they server their needs.

I recommend:

Thanks all.

react-event-calendar

A Calendar component that will display supplied events in a given month.

Demo & Examples

Live demo: dptoot.github.io/react-event-calendar

To build the examples locally, run:

npm install
npm start

Then open localhost:8080 in a browser.

Installation

The easiest way to use react-event-calendar is to install it from NPM

npm install react-event-calendar --save

You can also use the standalone build by including dist/react-event-calendar.js in your page. If you use this, make sure you have already included React, and it is available as a global variable.

Usage

Use this component to display a month view of a calendar with supplied event duration indicators.

const EventCalendar = require('react-event-calendar');

const events = [
    {
        start: '2015-07-20',
        end: '2015-07-02',
        eventClasses: 'optionalEvent'
        title: 'test event',
        description: 'This is a test description of an event',
    },
    {
        start: '2015-07-19',
        end: '2015-07-25',
        title: 'test event',
        description: 'This is a test description of an event',
        data: 'you can add what ever random data you may want to use later',
    },
];

<EventCalendar 
    month={7}
    year={2015}
    events={events} 
    onEventClick={(target, eventData, day) => console.log(eventData) 
    />

Properties

property type default description
events array Array of event objects to be represented on the calendar (see below for options)
month int (Required) Selected Month to display
year int (Required) Selected Year to display
wrapTitle boolean true Redisplay an event's title if it's duration wraps to the next week
maxEventSlots int 10 Maximum number of events to display per calendar day
onDayClick func(target, day) Callback for user click on any day (but not an event node)
onEventClick func(target, eventData, day) Callback for user click on any event node
onEventMouseOver func(target, eventData, day) Callback for user mouse over on any event node
onEventMouseOut func(target, eventData, day) Callback for user mouse out on any event node

Events object

The event object can contain any data you wish that may come in use to you later via the supplied Event Callbacks. There are hoever some required fields that must be populated. There are also optional data points that can be added to enhance each event.

Key Type Required Description
start string true Date of event start (Format: YYYY-MM-DD)
end string true Date of event end (Format: YYYY-MM-DD)
eventClasses string false CSS classes you wish applied to the event (space delimited)

Note

At this time any event indexed past the threshold supplied by maxEventSlots will never display. Given the purpose of the component is to show the start and end of event streams I am still trying to decide the best way to address "hidden" events. All ideas are welcome! :D

License

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright (c) 2015 James Lewis.

react-event-calendar's People

Contributors

calvinclaus avatar dchambers avatar dptoot avatar idolize avatar optilude avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-event-calendar's Issues

Events not rendering to calendar.

I cannot get the events to render in to the event slots using the example on the homepage:

var events = [{
            start: '2015-07-20',
            end: '2015-07-21',
            title: 'test event',
            description: 'This is a test description of an event',
        },
        {
            start: '2015-07-18',
            end: '2015-07-19',
            title: 'test event',
            description: 'This is a test description of an event',
            data: 'you can add what ever random data you may want to use later',
        },
        ];

        return (

            <div className="Calendar">
                <EventCalendar 
                    ref={(ref) => this.calendar = ref}
                    month={7} 
                    year={2015} 
                    events={events}/>
            </div>

        );

When I log the output of the calendar it has the correct props, just not rendering the data visually to the DOM.

how to run react event calendar

I have downloaded and unzipped React event project.

But how can I run the project. Should the project be located in localhost?

The project contains no index.html file?

I can see in the demo that you click on an event link that opens a modal window.

I would like to change it to, when you click on an event link, then shows a DIV with a button with free time to ..Når

BUT, it is possible to change colors size calendar.
Or is it limited to use API

index.jsx looks for JSX files but NPM package doesn't provide them.

import CalendarDay from './components/CalendarDay.jsx';
import CalendarEvent from './components/CalendarEvent.jsx';
import CalendarTitle from './components/CalendarTitle.jsx';

Those lines cause the NPM package to look for the JSX, which isn't in the NPM package. The following lines work:

import CalendarDay from './components/CalendarDay';
import CalendarEvent from './components/CalendarEvent';
import CalendarTitle from './components/CalendarTitle';

Error when rendering EventCalendar

Using React 0.14.8. I npm installed the component:

Implemented to EventCalendar based on example to render:

render: function() {

        const events = _.map(this.props.events, (function(e) {
            const from = moment(e.fromDate).format('YYYY-MM-DD');
            return {
                start: from,
                end: from,
                title: e.name,
                description: e.name,
                data: '',
                eventClasses: ''
            };
        }));

        return (
            <div>
                <EventCalendar
                    month={12}
                    year={2016}
                    events={events} />
            </div>
        );
    }

Got the following error in the console:

invariant.js:39 Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. Check the render method of 'CalendarView'.(…)

Has anyone seen this error as well? Any suggestions on how to fix or workaround? Most appreciated for any help.

Thanks
Tim

Passing date to event mouseover/click handlers

I have a need to display some contextual information (in a popover) depending on which day of a multi-day event is being hovered over/clicked.

It would be great if the calendar grid position was discoverable from the event handler so I could implement this.

Event titles overlapping each other

I noticed sometimes the titles do not stack correctly. You can see in the image the title 'Andrew Royce' event goes from the 8th to the 9th. The next event 'Sarah Bask' on the same line goes from the 9th to the 11th but you can see rather than being below 'Andrew Royce' it is behind it. If I continue to refresh every once in a while it will display correctly, not sure what the exact issue is though. I am using Chrome Version 50.0.2661.102 (64-bit)

Here is the data I used for the calendar.
[{"start":"2016-06-08","end":"2016-06-09","title":"ANDREW ROYCE"},{"start":"2016-06-09","end":"2016-06-11","title":"Sarah Bask"},{"start":"2016-06-11","end":"2016-06-12","title":"DoxAPI Test2MD"}]

https://www.dropbox.com/s/zbf753mcukaipim/Screenshot%202016-06-06%2013.41.28.png?dl=0

TypeError: Cannot read property 'object' of undefined

i am getting following error while integrating react-event-calender
./node_modules/react-event-calendar/dist-modules/components/CalendarDay.js
G:/Vibhu Office MS/ReactJs_workspace/react_calendly/rj_calendly/node_modules/react-event-calendar/dist-modules/components/CalendarDay.js:76
73 |
74 |
75 | CalendarDay.propTypes = {

76 | day: _react2.default.PropTypes.object.isRequired,
77 | isToday: _react2.default.PropTypes.bool,
78 | events: _react2.default.PropTypes.array,
79 | onClick: _react2.default.PropTypes.func

Uncaught TypeError: Cannot read property 'object' of undefined

The error log is as below:

at Object.defineProperty.value (app.js:76947)
at webpack_require (app.js:20)
at Object. (app.js:76306)
at webpack_require (app.js:20)
at Object.exports.__esModule (app.js:65534)
at webpack_require (app.js:20)
at Object.exports.__esModule (app.js:7532)
at webpack_require (app.js:20)
at Object.defineProperty.value (app.js:13922)
at webpack_require (app.js:20)

Is it just me? It seems that it's relevant to webpack, so is there anything I should change in webpack settings?

Getting eventData = false in onEventClick?

When I first load data and click on an event I occasionally get eventData with a value of false. When I click it a second time it has the correct data.

I'm sure it's not an issue with events, as they all render on the calendar correctly, and target.props.eventData looks correct (and I'm using that as a workaround for now). Any idea what could be causing this?

<EventCalendar
  month={currentTime.month()}
  year={currentTime.year()}
  events={events}
  onEventClick={(target, eventData) => {
    console.log(eventData); // => false
    console.log(target.props.eventData); // => the actual data
  }}
  onDayClick={this.handleDayClick}
  onEventMouseOver={this.handleEventMouseOver}
  onEventMouseOut={this.handleEventMouseOut} />

Cannot read property 'object' of undefined

Cannot read property 'object' of undefined
TypeError: Cannot read property 'object' of undefined
at Object. (/Users/graeme/Next/rainbow_recovery_next/node_modules/react-event-calendar/dist-modules/components/CalendarDay.js:76:36)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object. (/Users/graeme/Next/rainbow_recovery_next/node_modules/react-event-calendar/dist-modules/index.js:19:20)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)

Interval events?

Is there a way that i can set an event to appear every wednesday? a flag on an event would be good.
just set the event and it repeats itself every week / or month.

Syntax Issue In Readme

In the readMe, this code is missing a brace after onEventClick.

    month={7}
    year={2015}
    events={events} 
    onEventClick={(target, eventData, day) => console.log(eventData) 
    />```

Here is the fix.

```<EventCalendar 
    month={7}
    year={2015}
    events={events} 
    onEventClick={(target, eventData, day) => console.log(eventData)}
    />```

Also you could add this to the readMe.

To update import for ES6, use:

`import EventCalendar from 'react-event-calendar';`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.