1.0.8 • Published 9 months ago

vue3-jalali-calendar v1.0.8

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

vue3-jalali-calendar

Jalali Calendar for vue 3

with special thanks to @mostafa-jamali & @aminmokhtari94.

Preview images

Alt text Alt text

Links

npm: https://www.npmjs.com/package/vue3-jalali-calendar demo: https://vue3-jalali-calendar.netlify.app/

Installation

npm i vue3-jalali-calendar

Usage

then use the component in .vue files:

<template>
 <jalaliCalendar
 		:eventsList="events"
		:vacationsList="vacations"
		disablePastDays
		addEventButton
		@dayClick="showEventModal"
		@on-event-click="showEventModal"
 />
</template>

<script setup lang="ts">
import { ref } from "vue";
import { jalaliCalendar } from "vue3-jalali-calendar";


import moment from "jalali-moment";

const showEventModal = (e: any) => (console.log(e), alert("check your log")); // or open an modal
const events = ref([{
		startDateTime: moment("2023-03-06T13:37:41.020+00:00"),
		endDateTime: moment("2023-03-06T20:49:41.020+00:00"),
		title: "رویداد شماره ۱",
		color: "#29B6F6",
	}
]);
const vacations = ref([
{
		date: moment("1402/05/30", "jYYYY/jMM/jDD"),
		title: "روز طبیعت",
 },
]);
</script>

Available props

PropTypeDefaultDescription
date-formatString'jYYYY/jMM/jDD'Date input format of show-date, min-date, max-date
show-dateJalali Moment Object$moment()Init Date of the calendar
display-periodString'month''month' or 'week' period
events-listArray of EventObject[]List of Events
min-dateJalali Moment ObjectnullLimit minimum time to navigate to
max-dateJalali Moment ObjectnullLimit minimum time to navigate to
disable-todayBooleanfalseIf set, Today button and today mark won't show
disable-periodBooleanfalseIf set, Period change button won't show
hide-event-timesBooleanfalseIf set, Event date and time won't show
hide-month-shadowBooleanfalseIf set, Shadow of days not in showing month won't show
hide-past-days-shadowBooleanfalseIf set, Shadow of past days won't show
disablePastDaysBooleanfalseIf set, it makes past days unclickable and they won't emit on-day-click
addEventButtonBooleanfalseIf set, it creates a button that emits on-day-click

Events

These events emitted on actions in the persian calendar:

EventOutputDescription
on-day-clickJalali Moment ObjectA Day has been selected
on-event-clickEventObjectAn Event has been selected
on-display-period-change'week' | 'month'Display Period has been changed
on-page-addDisplay Page has been added
on-page-subtractDisplay Page has been subtracted

Event Item Properties

nameTypeDescription
startDateTimeJalali Moment ObjectThe moment the event starts on the calendar.
endDateTimeJalali Moment ObjectThe moment the event ends on the calendar.
titleStringThe name of the event shown on the calendar.
classesStringAny additional CSS classes you wish to assign to the event.
colorStringCSS Color for event background

Event Example:

	{
		startDateTime: moment("2023-03-06T13:37:41.020+00:00"),
		endDateTime: moment("2023-03-06T20:49:41.020+00:00"),
		title: "رویداد شماره ۱",
		color: "#29B6F6",
	},

Vacation Example:

	{
		date: "2023-08-19",
		description: "روز طبیعت",
	},

recommend reading

1.0.8

9 months ago

1.0.7

9 months ago

1.0.6

9 months ago

1.0.5

9 months ago

1.0.4

9 months ago

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago