0.4.5 • Published 1 day ago

calendareact v0.4.5

Weekly downloads
-
License
MIT
Repository
github
Last release
1 day ago

calendaReact

Month view Week view

Usage

Install: npm i calendareact

Use:

import Calendar, { Event } from 'calendareact'

const [createEventOpen, setCreateEventOpen] = useState(false)
const [editEventOpen, setEditEventOpen] = useState(false)
const [start, setStart] = useState<Dayjs | null>(null)
const [end, setEnd] = useState<Dayjs | null>(null)
const [event, setEvent] = useState<Event | null | undefined>(null)

const MyComponent = () => {
  const events: Event[] = [
    {
      title: 'Test',
      id: 'test',
      start: today.startOf('hour').hour(12),
      end: today.startOf('hour').hour(18)
    },
    {
      title: 'Test 2',
      id: 'test2',
      start: today.startOf('hour').subtract(1, 'day').hour(8),
      end: today.startOf('hour').subtract(1, 'day').hour(14)
    },
    {
      title: 'Test 3',
      id: 'test3',
      start: today.startOf('hour').subtract(2, 'day').hour(10),
      end: today.startOf('hour').subtract(2, 'day').hour(14)
    },
    {
      title: 'Test 4',
      id: 'test4',
      start: today.startOf('hour').subtract(3, 'day').hour(9),
      end: today.startOf('hour').subtract(3, 'day').hour(22)
    }
  ]

  return (
    <Calendar
      view='month'
      events={events}
      onSelectTime={(start: Dayjs | null, end: Dayjs | null) => {
        setStart(start)
        setEnd(end)
        setCreateEventOpen(true)
      }}
      onSelectEvent={(event: Event | null | undefined) => {
        setEvent(event)
        setEditEventOpen(true)
      }}
    />
  ) 
}
0.4.5

1 day ago

0.4.4

3 days ago

0.4.3

3 days ago

0.4.2

4 days ago

0.4.1

7 days ago

0.4.0

21 days ago

0.3.9

3 months ago

0.3.8

3 months ago

0.3.7

3 months ago

0.3.6

6 months ago

0.3.5

6 months ago

0.3.4

6 months ago

0.3.3

7 months ago

0.3.2

7 months ago

0.3.1

8 months ago

0.3.0

9 months ago

0.2.14

9 months ago

0.2.13

9 months ago

0.2.10

9 months ago

0.2.9

9 months ago

0.2.8

9 months ago

0.2.7

9 months ago

0.2.6

9 months ago

0.2.5

9 months ago

0.2.4

9 months ago

0.2.3

9 months ago

0.2.2

9 months ago

0.2.1

9 months ago

0.2.0

9 months ago

0.1.5

10 months ago

0.0.5

10 months ago

0.0.4

10 months ago

0.0.3

10 months ago

0.0.2

10 months ago

0.0.1

10 months ago