Skip to content

emotional-engineering/calendar

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rc-calendar


React Calendar

NPM version build status Test coverage gemnasium deps node version npm download

Screenshots

Feature

  • support ie8,ie8+,chrome,firefox,safari
  • support date, month, year, decade select panel
  • support week number
  • support en-us and zh-cn locale (ui and timeOffset)
  • support aria and keyboard accessibility

Keyboard

  • Previous month (PageUp)
  • Next month (PageDown)
  • tab into hour input: Last hour(Up), Next hour(Down)
  • tab into hour input: Last minute(Up), Next minute(Down)
  • tab into hour input: Last second(Up), Next second(Down)
  • Last year (Control + left)
  • Next year (Control + right)

install

rc-calendar

Usage

import Calendar from 'rc-calendar';
import React from 'react';
React.render(<Calendar />, container);

Development

npm install
npm start

Example

http://localhost:8001/examples/

online example:

http://react-component.github.io/calendar/examples/index.html

API

Calendar props

name type default description
prefixCls String prefixCls of this component
className String additional css class of root dom node
style Object additional style of root dom node
value GregorianCalendar current value like input's value
defaultValue GregorianCalendar defaultValue like input's defaultValue
locale Object import from 'rc-calendar/lib/locale/en-us' calendar locale
formatter GregorianCalendarFormatter use to format/parse value to/from input
disabledDate Function(current:GregorianCalendar):Boolean null whether to disable select of current date
showWeekNumber Boolean false whether to show week number of year
showToday Boolean true whether to show today button
showTime Boolean true whether to support time select
focused Boolean false whether to focus on render
onSelect Function(date: GregorianCalendar) function(){} called when a date is selected from calendar
onChange Function(date: GregorianCalendar) function(){} called when a date is changed inside calendar (next year/next month/keyboard)

rc-calendar/lib/RangeCalendar props

name type default description
prefixCls String prefixCls of this component
className String additional css class of root dom node
style Object additional style of root dom node
value GregorianCalendar[] current value range. with two elements.
defaultValue GregorianCalendar[] defaultValue range
locale Object import from 'rc-calendar/lib/locale/en-us' calendar locale
formatter String|GregorianCalendarFormatter. see GregorianCalendarFormatter spec yyyy-MM-dd or yyyy-MM-dd HH:mm:ss use to format/parse value to/from input
disabledDate Function(current:GregorianCalendar):Boolean null whether to disable select of current date
showWeekNumber Boolean false whether to show week number of year
showTime Boolean true whether to support time select
onSelect Function(date: GregorianCalendar[]) function(){} called when a date range is selected from calendar
onChange Function(date: GregorianCalendar[]) function(){} called when a date range is changed inside calendar (next year/next month/keyboard)

rc-calendar/lib/MonthCalendar props

name type default description
prefixCls String prefixCls of this component
className String additional css class of root dom node
style Object additional style of root dom node
value GregorianCalendar current value like input's value
defaultValue GregorianCalendar defaultValue like input's defaultValue
locale Object import from 'rc-calendar/lib/locale/en-us' calendar locale
disabledDate Function(current:GregorianCalendar):Boolean null whether to disable select of current month
getCalendarContainer Function():Element function(){return document.body;} dom node where calendar to be rendered into
onSelect Function(date: GregorianCalendar) function(){} called when a date is selected from calendar
onChange Function(date: GregorianCalendar) function(){} called when a date is changed inside calendar (next year/next month/keyboard)

rc-calendar/lib/Picker props

name type default description
prefixCls String prefixCls of this component
calendar Calendar React Element
disabled Boolean whether picker is disabled
orient String[] affect the position of arrow. exp: ['left','top']
adjustOrientOnCalendarOverflow Boolean true whether adjust calendar orient if there is not enough space to show. better false if animation is 'slide-up'
animation String index.css support 'slide-up'
transitionName String css class for animation
value GregorianCalendar current value like input's value
defaultValue GregorianCalendar defaultValue like input's defaultValue
onChange Function called when select a different value
onOpen Function called when open picker
onClose Function called when close picker
open Boolean current open state of picker. controlled prop

Test Case

http://localhost:8001/tests/runner.html?coverage

Coverage

http://localhost:8001/node_modules/rc-server/node_modules/node-jscover/lib/front-end/jscoverage.html?w=http://localhost:8001/tests/runner.html?coverage

License

rc-calendar is released under the MIT license.

About

React Calendar

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 85.9%
  • CSS 14.1%