2.4.3 • Published 9 months ago

react-calendar-z v2.4.3

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

NPM JavaScript Style Guide

Description

  • Calendar view, selected, small.
  • Support to display the first day of the week: monday, sunday, friday or saturday
  • Can be range date selected. (limit date)
  • Support customize label (if needed)
  • Light, no use lib: momentjs, dayjs...
  • Add full all classes for all dates
  • Mode: showMonthYearSelection

Preview

Date-Calendar

Date-Calendar

Date-Calendar

Date-Calendar

Usage

Install the package

npm install react-calendar-z

Import the module in the place you want to use:

import "react-calendar-z/build/styles.css";
import Calendar from "react-calendar-z";

Snippet

    // 2022, aug 10
    const [date, setDate] = useState(new Date(2022, 7, 10));

    <Calendar
      value={date}
      onSelectedValue={setDate}
    />

props

see index.d.ts

propstypedescription
classNamestring
labelMonthYearClassNamestring
weekClassNamestring
widthstring / number
heightstring / number
labelNextstring / React.ReactNode
labelBackstring / React.ReactNode
weekStartenum (sunday / monday / friday / saturday)default: sunday
fitMonthDaybooleanfalse: display dates of other months
showboolean
showAnchorboolean
valueDatevalue selected DATE
i18nLabelWeekIWeekLabel[] / string[]: from sunday, monday... -> saturdayauto mapping with weekStart
i18nLabelMonthstring[]
bookmarkDatesIBookmarkDate[]add a class to bookmark
onSelectedValue(value: Date) => anyset selected value DATE
onChangeView(mode: TModeView) => any
onClickWeekLabel(weekLabel: IWeekLabel) => any
formatTittleYearMonth(year: number, month: number, decadeData?: number[])your format
readOnlyboolean
neighborMonthClassNamestringthe className of the date
showTodayboolean
todayClassNamestring
selectedClassNamestring
formatDayValue(day: number) => string / React.ReactNode
minYearnumberdefault: currentYear - 100
maxYearnumberdefault: currentYear + 100
notBeforeTimeDatedefault: undefined
notAfterTimeDatedefault: undefined
minimumDayCanLargeThanTodaybooleanfalse
showMonthYearSelectionbooleanfalse: display selection month year
showNextBackbooleanfalse: display next back
rightNextBackbooleandisplay position next back
showFooterbooleanshow footer (selection date and clear status)
showXClosebooleanbutton clear status
xCloseIconstring / React.ReactNodecustomize x-close
formatSelectedDate(date: Date) => string / React.ReactNodeformat in footer (default MMM DD, yyyy)

Note

xCloseIcon: When you press x to close, it will display the currently selected date again.


IWeekLabel {
  name: string; // custom label
  shortName: string; // custom short name => display name || name
  ...
}

IBookmarkDate {
  date: date; // date bookmark
  className: string; // class bookmark
  ...
}

// describe
formatTittleYearMonth: function(year: number, month: number, decadeData?: number[]) => {
  // you can set display title calendar
}

// describe
formatDayValue: function(day: number) => {
  // you can set format date
}

// describe
`minYear` | `maxYear`: Limited years can be displayed/selected
`notBeforeTime` | `notAfterTime`: Selectable date limit

// describe
`notBeforeTime` takes precedence over `minYear`
`notAfterTime` takes precedence over `maxYear`
=> we cannot select data before or after the specified data

// describe
double click title to change mode view

// weekStart: normore: see https://en.wikipedia.org/wiki/Week
`monday`, `sunday`, `friday` or `saturday` > v2.3.1

RUN

LIVE EXAMPLE

License

MIT

2.3.0

9 months ago

2.2.1

9 months ago

2.2.0

9 months ago

2.4.1

9 months ago

2.4.0

9 months ago

2.3.1

9 months ago

2.4.3

9 months ago

2.4.2

9 months ago

2.1.0

9 months ago

2.0.1-zxp

11 months ago

2.0.0

3 years ago

1.0.3

3 years ago

1.0.2-z

3 years ago

1.0.2

3 years ago

2.0.0-alp

3 years ago

1.1.0-alp

3 years ago

1.1.0-z

3 years ago

1.1.0

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago