0.1.0 • Published 4 years ago

react-calendar-from-scratch v0.1.0

Weekly downloads
5
License
-
Repository
-
Last release
4 years ago

REACT EVENT CALENDAR FROM SCRATCH

An event calendar like the google's calendar with generic style.

Installation

npm i react-full-event-calendar

or

yarn add react-full-event-calendar

Day Calendar

Week Calendar

Month Calendar

Usage

const Calendar = require('react-full-event-calendar');

const titleText = 'working in the weekend';

const events = [
  {
    startTime: new Date(moment().add(2, 'hour')),
    endTime: new Date(moment().add(3, 'hour')),
    title: 'working in the weekend',
  },
  {
    startTime: new Date(moment().add(-3, 'hour')),
    endTime: new Date(moment().add(-2, 'hour')),
    title: 'working in the weekend',
  },
  {
    startTime: new Date(),
    endTime: new Date(moment().add(1, 'hour')),
    title: 'working in the weekend',
  },
];

<Calendar
  events={events}
/>

Props

PropertyTypeDefaultDescription
eventsArrayRequiredEvents to display on the calendar
dayOrientationStringhorizontalThe orientation of the day calendar, either 'vertical' or 'horizontal'
defautlCalendarViewStringweekThe default calendar to show, either 'day', 'week' or 'month'
defaultDateDatenew Date()The date to start on when mounted
onDayChangefunc(day, newDay)Callback when the day change on day calendar
onWeekChangefunc(newStartOfTheWeek, newEendOfTheWeek)Callback when the week change on week calendar
onMonthChangefunc(newMonth, newYear)Callback when the month change on month calendar

Event Objects

KeyTypeRequiredDescription
titleStringtrueThe title of the event
startTimeDatetrueThe start time of the event
endTimeDatetrueThe end time of the event

DEMO

Demo

Authors

See also the list of contributors who participated in this project.