1.0.8 • Published 1 year ago

lunar-calendar-react v1.0.8

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

Lunar Calendar React

This is for React.

For Vue version please go to my-lunar-calendar.

Supports both solar and lunar calendar displaying.

Displaying events is supported.

Please see the configurations below.

Configurations

NameData TypeDefaultDescriptionExample
wrapperStylesObject{}Calendar root element styles{ paddingTop: '10px' }
childWrapperStylesObject{}Input child wrapper element styles{ paddingTop: '10px' }
rowStylesObject{}Row styles{ paddingTop: '10px' }
cellStylesObject{}Cell styles{ paddingTop: '10px' }
lunarTextStylesObject{}Lunar text styles{ paddingTop: '10px' }
toolbarStylesObject{}Toolbar styles{ paddingTop: '10px' }
selectedCellStylesObject{}Selected date styles{ backgroundColor: 'blue' }
hideToolbarBooleanfalseIf true will hide toolbartrue
autoHideToolbarBooleanfalseIf true only show toolbar when mouse hover on it. The layout won't change, use css visibilitytrue
showLunarBooleanfalseIf true will show lunar date and termtrue
alwaysShowBooleanfalseIt's suitable for read mode or put it anywhere for customizationtrue
showWeeksInEnBooleanfalseShow weeks in Englishtrue
showTimeBooleanfalseShow both date and time, only show hours and minutes by defaulttrue
showSecondsBooleanfalseShow secondstrue
showTodayStyleBooleantrueShow special style for todayfalse
noBgBooleanfalseIf true the background will be transparent without bordertrue
selectedDateDatenowCurrent datenew Date()
lunarSameRowBooleanfalseIf true will put solar and lunar text in the same rowtrue
showEventsBooleantrueIf no events, then no difference with falsefalse
showEventsOnlyCountBooleanfalseOnly show event numberstrue
eventStylesObject{}Set maxWidth, etc{ maxWidth: '40px'}
eventCountStylesObject{}Event numbers style{ width: '20px', color: 'blue'}
eventsObject Array[]Events array, name is required. Any other properties are accepted[{ date: '2023-11-01', events: { name: 'Happy New Year' }, { name: 'Birthday' }},]

event: selectDate(data, e), result as below

Data

{
    "year": 2023,
    "month": 11,
    "date": 16,
    "lunarYear": 2023,
    "lunarMonth": "十月",
    "lunarDate": "初四",
    "lunarWeek": "星期四",
    "animal": "兔",
    "gzDay": "戊寅",
    "gzMonth": "癸亥",
    "gzYear": "癸卯",
    "isLeap": false,
    "week": 4,
    "term": null,
    "fullDate": "2023-11-16"
    "hour": 18,
    "minute": 6,
    "second": 25,
    "fullTime": "18:06:25",
    "fullDateTime": "2023-11-16 18:06:25"
}

Event

Event object

event: selectEvent(eventData, dateData, e), result as below

Event data

{ "name": "Happy New Year" }

Date data

{
  "year": 2023,
  "month": 11,
  "date": 1,
  "label": 1,
  "lunarDate": "十八",
  "events": [{ "name": "Happy New Year" }, { "name": "Birthday" }],
  "term": null,
  "fullDate": "2023-11-01"
}

Click event

Event object

event: selectEventCount(dateData, e), result as below

Date data

{
  "year": 2023,
  "month": 11,
  "date": 1,
  "label": 1,
  "lunarDate": "十八",
  "events": [{ "name": "Happy New Year" }, { "name": "Birthday" }],
  "term": null,
  "fullDate": "2023-11-01"
}

Click event

Event object

usages

Import component anywhere you need

import { LunarCalendarReact } from 'lunar-calendar-react';

<LunarCalendarReact><input /></LunarCalendarReact>

<LunarCalendarReact
    showEvents={true}
    events={[
        {
        date: '2023-11-23',
        events: [{ name: 'New year' }, { name: 'aaa' }],
        },
    ]}
    showEventsOnlyCount={true}
    showTime={true}
    showLunar={true}
    onSelectDate={console.log}
    alwaysShow={true}
/>

Examples

Wrapped by custom element without bg

Wrapped by custom element without bg

Lunar calendar

Lunar calendar

Show weeks in English

Show weeks in English

Show time

Show weeks in English

Select year panel

Select year panel

Lunar same row

Lunar same row

Event count

Event count

Event count tooltip

Event count tooltip

Event text

Event text

Event text tooltip

Event text tooltip

Support

For customizations, please send email to 442875974@qq.com.

1.0.8

1 year ago

1.0.6

1 year ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago