Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rc-year-calendar

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-year-calendar

Official react wrapper for the year-calendar widget

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.7K
decreased by-10.42%
Maintainers
1
Weekly downloads
 
Created
Source

rc-year-calendar

Official React.js wrapper for the year-calendar widget. https://year-calendar.github.io/

CircleCI NPM

This library is also available for:

Pure javascript Vue.js

Installation

You can get the widget using the following methods:

  • From the GitHub repository
  • From the Node package manager, using the following command: npm install rc-year-calendar
  • From Yarn, using the following command: yarn add rc-year-calendar
  • From the CDN, using the following script: <script src="https://unpkg.com/rc-year-calendar@latest/dist/rc-year-calendar.umd.min.js"></script>

Usage

You can create a calendar using the following javascript code :

// Import (only if not using the CDN installation option)
import Calendar from 'rc-year-calendar';

// Render
render() {
    return (<Calendar />);
}

Using options

You can specify props to customize the calendar:

render() {
    return (
        <Calendar style="background" minDate={new Date()} />
    );
}

The props are the following

Option nameDescriptionTypeDefault value
allowOverlapSpecifies whether the user can select a range which overlapping an other element present in the datasource.booleantrue
alwaysHalfDaySpecifies whether the beginning and the end of each range should be displayed as half selected day.booleanfalse
contextMenuItemsSpecifies the items of the default context menu.array[]
customDayRendererSpecify a custom renderer for data source. Works only with the style set to "custom". This function is called duringender for each day containing at least one event.Render functionnull
customDataSourceRendererSpecify a custom renderer for days. This function is called during render for each day.Render functionnull
dataSourceThe elements that must be displayed on the calendar.array or function[]
disabledDaysThe days that must be displayed as disabled.array[]
disabledWeekDaysThe days of the week that must be displayed as disabled (0 for Sunday, 1 for Monday, etc.).array[]
displayDisabledDataSourceSpecifies whether the data source must be rendered on disabled days.booleanfalse
displayHeaderSpecifies whether the calendar header is displayed.booleantrue
displayWeekNumberSpecifies whether the weeks number are displayed.booleanfalse
enableContextMenuSpecifies whether the default context menu must be displayed when right clicking on a day.booleanfalse
enableRangeSelectionSpecifies whether the range selection is enabled.booleanfalse
hiddenWeekDaysThe days of the week that must not be displayed (0 for Sunday, 1 for Monday, etc.).array[]
languageThe language/culture used for calendar rendering.Stringen
loadingTemplateA custom loading templateStringnull
maxDateThe date until which days are enabled.Datenull
minDateThe date from which days are enabled.Datenull
roundRangeLimitsSpecifies whether the beginning and the end of each range should be displayed as rounded cells.booleanfalse
styleSpecifies the style used for displaying datasource ("background", "border" or "custom").stringborder
weekStartThe starting day of the week. This option overrides the parameter define in the language file.number0
yearThe year displayed by the calendar.numberCurrent year
defaultYearThe year on which the calendar should be opened.numberCurrent year
Event nameDescriptionParameter
onDayClickFunction fired when a day is clicked.{ date, events }
onDayContextMenuFunction fired when a day is right clicked.{ date, events }
onDayEnterFunction fired when the mouse enter on a day.{ date, events }
onDayLeaveFunction fired when the mouse leaves a day.{ date, events }
onRangeSelectedFunction fired when a date range is selected.{ startDate, endDate }
onRenderEndFunction fired when the calendar rendering is ended.{ currentYear }
onYearChangedFunction fired when the visible year of the calendar is changed.{ currentYear }

Language

If you want to use the calendar in a different language, you should import the locale file corresponding to the language you want to use, and then set the language prop of the calendar:

import Calendar from 'rc-year-calendar';
import 'rc-year-calendar/locales/rc-year-calendar.fr';

OR

<script src="https://unpkg.com/rc-year-calendar@latest/dist/rc-year-calendar.umd.min.js"></script>
<script src="https://unpkg.com/rc-year-calendar@latest/locales/rc-year-calendar.fr.js"></script>

Then

render() {
    return (
        <Calendar language="fr" />
    );
}

The list of available languages is available here

What next

Check the examples page to discover all the functionalities.

Keywords

FAQs

Package last updated on 29 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc