1.0.0-az • Published 10 months ago
sveltecalzzzss-z v1.0.0-az
Description
- Calendar view, selected, small.
- Can be range date selected, read-only
- Support customize label (if need)
- Support to display the first day: monday or sunday // (checking with another day...)
- light, no use lib: momentjs, dayjs...
Preview
Usage
Install the package
npm install svelte-calendar-z
Import the module in the place you want to use:
import "svelte-calendar-z/dist/styles.css";
import Calendar from "svelte-calendar-z";
Snippet
let date = new Date(2022, 8, 10);
<Calendar
value={date}
onSelectedValue={d => (date = d)}
// showToday={true}
// showAnchor
// i18nLabelWeek={labelWeekDays}
// notBeforeTime={new Date()} >=
// notAfterTime={new Date(2022, 7, 12)} <=
// show => handle show hide (when hide => reset mode to weekview)
/>
props
see index.d.ts
props | type | description |
---|
className?: string;
todayClassName?: string;
selectedClassName?: string;
neighborMonthClassName?: string;
labelMonthYearClassName?: string;
width?: string | number;
// height?: string | number; => if update height, please change line-height of cell
labelNext?: string | Element;
labelBack?: string | Element;
weekStart?: "monday" | "sunday";
notBeforeTime?: Date; // => for range time
notAfterTime?: Date; // => for range time
readOnly?: boolean; // mode readOnly
show?: boolean; // handle show by is
showAnchor?: boolean;
value?: Date; // selected value
showToday?: boolean; // default true
fitMonthDay?: boolean; // remove dispaly other month
// set from name and short-name order by Sunday => Monday
i18nLabelWeek?: IWeekLabel[]; // display customize label
i18nLabelMonth?: string[]; // display customize label
onSelectedValue?: (value: Date) => any;
// customize format title
formatTittleYearMonth?: (
year: number,
month: number,
decadeData?: number[]
) => string | Element;
// => year/month !== -1 => modeview week
// => year !== -1/month == -1 => modeview month
// => decadeData !== underfined => modeview year
// support customize format day
formartDayValue?: (day: number) => string | Element;
Note
RUN
LIVE EXAMPLE
License
MIT
1.0.0-az
10 months ago